occam-verify-cli 1.0.72 → 1.0.75
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 +29 -29
- package/lib/dom/axiom.js +12 -12
- package/lib/dom/derivation.js +23 -23
- package/lib/dom/premise.js +20 -20
- package/lib/dom/proof.js +7 -7
- package/lib/dom/reference.js +7 -7
- package/lib/dom/rule.js +25 -25
- package/lib/dom/statement.js +13 -13
- package/lib/dom/step.js +228 -0
- package/lib/dom/subDerivation.js +23 -23
- package/lib/dom/subproof.js +14 -14
- package/lib/dom/supposition.js +20 -20
- package/lib/dom/topLevelAssertion.js +25 -25
- package/lib/index.js +2 -2
- package/lib/mixins/step/unify.js +181 -0
- package/lib/utilities/subproof.js +3 -3
- package/package.json +6 -6
- package/src/context/file.js +3 -3
- package/src/context/local.js +32 -32
- package/src/dom/axiom.js +11 -11
- package/src/dom/derivation.js +26 -26
- package/src/dom/premise.js +23 -23
- package/src/dom/proof.js +6 -6
- package/src/dom/reference.js +5 -5
- package/src/dom/rule.js +21 -21
- package/src/dom/statement.js +11 -11
- package/src/dom/{proofStep.js → step.js} +25 -25
- package/src/dom/subDerivation.js +26 -26
- package/src/dom/subproof.js +9 -9
- package/src/dom/supposition.js +25 -25
- package/src/dom/topLevelAssertion.js +21 -21
- package/src/index.js +1 -1
- package/src/mixins/{proofStep → step}/unify.js +13 -13
- package/src/utilities/subproof.js +5 -5
- package/lib/dom/proofStep.js +0 -228
- package/lib/mixins/proofStep/unify.js +0 -181
package/src/dom/proof.js
CHANGED
|
@@ -17,12 +17,12 @@ export default domAssigned(class Proof {
|
|
|
17
17
|
return this.derivation;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
getLastStep() { return this.derivation.getLastStep(); }
|
|
21
21
|
|
|
22
22
|
getStatement() {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
statement =
|
|
23
|
+
const lastStep = this.getLastStep(),
|
|
24
|
+
lastStepStatement = lastStep.getStatement(),
|
|
25
|
+
statement = lastStepStatement; ///
|
|
26
26
|
|
|
27
27
|
return statement;
|
|
28
28
|
}
|
|
@@ -37,9 +37,9 @@ export default domAssigned(class Proof {
|
|
|
37
37
|
const derivationVerified = this.derivation.verify(substitutions, context);
|
|
38
38
|
|
|
39
39
|
if (derivationVerified) {
|
|
40
|
-
const
|
|
40
|
+
const lastStep = context.getLastStep();
|
|
41
41
|
|
|
42
|
-
if (
|
|
42
|
+
if (lastStep !== null) {
|
|
43
43
|
const statement = this.getStatement(),
|
|
44
44
|
conclusionStatement = conclusion.getStatement(),
|
|
45
45
|
conclusionStatementEqualToStatement = conclusionStatement.isEqualTo(statement);
|
package/src/dom/reference.js
CHANGED
|
@@ -10,7 +10,7 @@ import { referenceMetaType } from "../dom/metaType";
|
|
|
10
10
|
import { unifyMetavariableIntrinsically } from "../utilities/unification";
|
|
11
11
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const stepReferenceNodeQuery = nodeQuery("/step/reference"),
|
|
14
14
|
procedureCallReferenceNodeQuery = nodeQuery("/procedureCall/reference"),
|
|
15
15
|
declarationMetavariableNodeQuery = nodeQuery("/declaration/metavariable"),
|
|
16
16
|
satisfyingAssertionMetavariableNodeQuery = nodeQuery("/satisfyingAssertion/metavariable");
|
|
@@ -186,13 +186,13 @@ export default domAssigned(class Reference {
|
|
|
186
186
|
return reference;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
static
|
|
189
|
+
static fromStepNode(stepNode, fileContext) {
|
|
190
190
|
let reference = null;
|
|
191
191
|
|
|
192
|
-
const
|
|
192
|
+
const stepReferenceNode = stepReferenceNodeQuery(stepNode);
|
|
193
193
|
|
|
194
|
-
if (
|
|
195
|
-
const referenceNode =
|
|
194
|
+
if (stepReferenceNode !== null) {
|
|
195
|
+
const referenceNode = stepReferenceNode; ///
|
|
196
196
|
|
|
197
197
|
reference = referenceFromReferenceNode(referenceNode, fileContext);
|
|
198
198
|
}
|
package/src/dom/rule.js
CHANGED
|
@@ -69,8 +69,8 @@ export default domAssigned(class Rule {
|
|
|
69
69
|
return metavariableNameMatches;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
let
|
|
72
|
+
unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, context) {
|
|
73
|
+
let statementAndStepsOrSubproofsUnified = false;
|
|
74
74
|
|
|
75
75
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
76
76
|
generalContext = localContext, ///
|
|
@@ -80,16 +80,16 @@ export default domAssigned(class Rule {
|
|
|
80
80
|
statementUnifiedWithConclusion = this.unifyStatementWithConclusion(statement, substitutions, generalContext, specificContext);
|
|
81
81
|
|
|
82
82
|
if (statementUnifiedWithConclusion) {
|
|
83
|
-
const
|
|
83
|
+
const stepsOrSubproofsUnifiedWithPremises = this.unifyStepsOrSubproofsWithPremises(stepsOrSubproofs, substitutions, generalContext, specificContext);
|
|
84
84
|
|
|
85
|
-
if (
|
|
85
|
+
if (stepsOrSubproofsUnifiedWithPremises) {
|
|
86
86
|
const substitutionsResolved = substitutions.areResolved();
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
statementAndStepsOrSubproofsUnified = substitutionsResolved; ///
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
return
|
|
92
|
+
return statementAndStepsOrSubproofsUnified;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
unifyStatementWithConclusion(statement, substitutions, generalContext, specificContext) {
|
|
@@ -102,43 +102,43 @@ export default domAssigned(class Rule {
|
|
|
102
102
|
return statementUnifiedWithConclusion;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
unifyStepsOrSubproofsWithPremises(stepsOrSubproofs, substitutions, generalContext, specificContext) {
|
|
106
|
+
stepsOrSubproofs = reverse(stepsOrSubproofs); ///
|
|
107
107
|
|
|
108
|
-
const
|
|
109
|
-
const
|
|
108
|
+
const stepsOrSubproofsUnifiedWithPremises = backwardsEvery(this.premises, (premise) => {
|
|
109
|
+
const stepUnifiedWithPremise = this.unifyStepsOrSubproofsWithPremise(stepsOrSubproofs, premise, substitutions, generalContext, specificContext);
|
|
110
110
|
|
|
111
|
-
if (
|
|
111
|
+
if (stepUnifiedWithPremise) {
|
|
112
112
|
return true;
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
return
|
|
116
|
+
return stepsOrSubproofsUnifiedWithPremises;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
let
|
|
119
|
+
unifyStepsOrSubproofsWithPremise(stepsOrSubproofs, premise, substitutions, generalContext, specificContext) {
|
|
120
|
+
let stepsOrSubproofsUnifiedWithPremise =false;
|
|
121
121
|
|
|
122
122
|
const context = specificContext, ///
|
|
123
123
|
premiseUnifiedIndependently = premise.unifyIndependently(substitutions, context);
|
|
124
124
|
|
|
125
125
|
if (premiseUnifiedIndependently) {
|
|
126
|
-
|
|
126
|
+
stepsOrSubproofsUnifiedWithPremise = true;
|
|
127
127
|
} else {
|
|
128
|
-
const
|
|
129
|
-
const
|
|
128
|
+
const step = extract(stepsOrSubproofs, (stepOrSubproof) => {
|
|
129
|
+
const stepOrSubproofUnified = premise.unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext);
|
|
130
130
|
|
|
131
|
-
if (
|
|
131
|
+
if (stepOrSubproofUnified) {
|
|
132
132
|
return true;
|
|
133
133
|
}
|
|
134
134
|
}) || null;
|
|
135
135
|
|
|
136
|
-
if (
|
|
137
|
-
|
|
136
|
+
if (step !== null) {
|
|
137
|
+
stepsOrSubproofsUnifiedWithPremise = true;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
return
|
|
141
|
+
return stepsOrSubproofsUnifiedWithPremise;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
verify() {
|
package/src/dom/statement.js
CHANGED
|
@@ -15,10 +15,10 @@ import { definedAssertionFromStatement, containedAssertionFromStatement, subproo
|
|
|
15
15
|
|
|
16
16
|
const { match, backwardsSome } = arrayUtilities;
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const stepStatementNodeQuery = nodeQuery("/step/statement"),
|
|
19
|
+
statementTermNodesQuery = nodesQuery("/statement//term"),
|
|
19
20
|
statementFrameNodesQuery = nodesQuery("/statement//frame"),
|
|
20
21
|
premiseStatementNodeQuery = nodeQuery("/premise/statement"),
|
|
21
|
-
proofStepStatementNodeQuery = nodeQuery("/proofStep/statement"),
|
|
22
22
|
deductionStatementNodeQuery = nodeQuery("/deduction/statement"),
|
|
23
23
|
conclusionStatementNodeQuery = nodeQuery("/conclusion/statement"),
|
|
24
24
|
suppositionStatementNodeQuery = nodeQuery("/supposition/statement"),
|
|
@@ -233,19 +233,19 @@ export default domAssigned(class Statement {
|
|
|
233
233
|
return unifiedIndependently;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
|
|
237
|
-
let
|
|
236
|
+
unifyWithStepsOrSubproofs(stepsOrSubproofs, context) {
|
|
237
|
+
let unifiedWithSteps;
|
|
238
238
|
|
|
239
|
-
|
|
239
|
+
unifiedWithSteps = backwardsSome(stepsOrSubproofs, (stepOrSubproof) => {
|
|
240
240
|
const statement = this, ///
|
|
241
|
-
statementUnified =
|
|
241
|
+
statementUnified =stepOrSubproof.unifyStatement(statement, context);
|
|
242
242
|
|
|
243
243
|
if (statementUnified) {
|
|
244
244
|
return true;
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
|
|
248
|
-
return
|
|
248
|
+
return unifiedWithSteps;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
toJSON() {
|
|
@@ -287,13 +287,13 @@ export default domAssigned(class Statement {
|
|
|
287
287
|
return statement;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
static
|
|
290
|
+
static fromStepNode(stepNode, fileContext) {
|
|
291
291
|
let statement = null;
|
|
292
292
|
|
|
293
|
-
const
|
|
293
|
+
const stepStatementNode = stepStatementNodeQuery(stepNode);
|
|
294
294
|
|
|
295
|
-
if (
|
|
296
|
-
const statementNode =
|
|
295
|
+
if (stepStatementNode !== null) {
|
|
296
|
+
const statementNode = stepStatementNode; ///
|
|
297
297
|
|
|
298
298
|
statement = statementFromStatementNode(statementNode, fileContext);
|
|
299
299
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
|
-
import unifyMixins from "../mixins/
|
|
4
|
+
import unifyMixins from "../mixins/step/unify";
|
|
5
5
|
import Substitutions from "../substitutions";
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
8
|
import { domAssigned } from "../dom";
|
|
9
9
|
import { propertyAssertionFromStatement } from "../utilities/context";
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const stepNodeQuery = nodeQuery("/step");
|
|
12
12
|
|
|
13
|
-
export default domAssigned(class
|
|
13
|
+
export default domAssigned(class Step {
|
|
14
14
|
constructor(string, statement, reference) {
|
|
15
15
|
this.string = string;
|
|
16
16
|
this.statement = statement;
|
|
@@ -35,10 +35,10 @@ export default domAssigned(class ProofStep {
|
|
|
35
35
|
return qualified;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
const
|
|
38
|
+
isStep() {
|
|
39
|
+
const step = true;
|
|
40
40
|
|
|
41
|
-
return
|
|
41
|
+
return step;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
matchTermAndPropertyRelation(term, propertyRelation, context) {
|
|
@@ -56,9 +56,9 @@ export default domAssigned(class ProofStep {
|
|
|
56
56
|
unify(substitutions, context) {
|
|
57
57
|
let unified;
|
|
58
58
|
|
|
59
|
-
const
|
|
59
|
+
const stepString = this.string; ///
|
|
60
60
|
|
|
61
|
-
context.trace(`Unifying the '${
|
|
61
|
+
context.trace(`Unifying the '${stepString}' step...`);
|
|
62
62
|
|
|
63
63
|
unified = unifyMixins.some((unifyMixin) => {
|
|
64
64
|
const unified = unifyMixin(this.statement, this.reference, substitutions, context);
|
|
@@ -69,7 +69,7 @@ export default domAssigned(class ProofStep {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
if (unified) {
|
|
72
|
-
context.debug(`...unified the '${
|
|
72
|
+
context.debug(`...unified the '${stepString}' step.`);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return unified;
|
|
@@ -78,9 +78,9 @@ export default domAssigned(class ProofStep {
|
|
|
78
78
|
verify(substitutions, assignments, context) {
|
|
79
79
|
let verified = false;
|
|
80
80
|
|
|
81
|
-
const
|
|
81
|
+
const stepString = this.string;
|
|
82
82
|
|
|
83
|
-
context.trace(`Verifying the '${
|
|
83
|
+
context.trace(`Verifying the '${stepString}' step...`);
|
|
84
84
|
|
|
85
85
|
if (this.statement !== null) {
|
|
86
86
|
const qualified = this.isQualified(),
|
|
@@ -97,11 +97,11 @@ export default domAssigned(class ProofStep {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
} else {
|
|
100
|
-
context.debug(`Cannot verify the '${
|
|
100
|
+
context.debug(`Cannot verify the '${stepString}' step because it is nonsense.`);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
if (verified) {
|
|
104
|
-
context.debug(`...verified the '${
|
|
104
|
+
context.debug(`...verified the '${stepString}' step.`);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
return verified;
|
|
@@ -126,32 +126,32 @@ export default domAssigned(class ProofStep {
|
|
|
126
126
|
return statementUnified;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
static name = "
|
|
129
|
+
static name = "Step";
|
|
130
130
|
|
|
131
131
|
static fromStatement(statement, context) {
|
|
132
132
|
const statementString = statement.getString(),
|
|
133
133
|
string = statementString, ///
|
|
134
134
|
reference = null,
|
|
135
|
-
|
|
135
|
+
step = new Step(string, statement, reference);
|
|
136
136
|
|
|
137
|
-
return
|
|
137
|
+
return step;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
static
|
|
141
|
-
let
|
|
140
|
+
static fromStepOrSubproofNode(stepOrSubproofNode, fileContext) {
|
|
141
|
+
let step = null;
|
|
142
142
|
|
|
143
|
-
const
|
|
143
|
+
const stepNode = stepNodeQuery(stepOrSubproofNode);
|
|
144
144
|
|
|
145
|
-
if (
|
|
145
|
+
if (stepNode !== null) {
|
|
146
146
|
const { Statement, Reference } = dom,
|
|
147
|
-
node =
|
|
147
|
+
node = stepNode, ///
|
|
148
148
|
string = fileContext.nodeAsString(node),
|
|
149
|
-
statement = Statement.
|
|
150
|
-
reference = Reference.
|
|
149
|
+
statement = Statement.fromStepNode(stepNode, fileContext),
|
|
150
|
+
reference = Reference.fromStepNode(stepNode, fileContext);
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
step = new Step(string, statement, reference);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
return
|
|
155
|
+
return step;
|
|
156
156
|
}
|
|
157
157
|
});
|
package/src/dom/subDerivation.js
CHANGED
|
@@ -10,39 +10,39 @@ import { assignAssignments } from "../utilities/assignments";
|
|
|
10
10
|
|
|
11
11
|
const { last } = arrayUtilities;
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const stepOrSubproofNodesQuery = nodesQuery("/subDerivation/step|subproof");
|
|
14
14
|
|
|
15
15
|
export default domAssigned(class SubDerivation {
|
|
16
|
-
constructor(
|
|
17
|
-
this.
|
|
16
|
+
constructor(stepsOrSubproofs) {
|
|
17
|
+
this.stepsOrSubproofs = stepsOrSubproofs;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
return this.
|
|
20
|
+
getStepsOrSubproofs() {
|
|
21
|
+
return this.stepsOrSubproofs;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
24
|
+
getLastStep() {
|
|
25
|
+
const lastStepOrSubproof = last(this.stepsOrSubproofs),
|
|
26
|
+
lastStep = lastStepOrSubproof; ///
|
|
27
27
|
|
|
28
|
-
return
|
|
28
|
+
return lastStep;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
verify(substitutions, context) {
|
|
32
32
|
let verified;
|
|
33
33
|
|
|
34
|
-
verified = this.
|
|
34
|
+
verified = this.stepsOrSubproofs.every((stepOrSubproof) => { ///
|
|
35
35
|
const assignments = [],
|
|
36
|
-
|
|
36
|
+
stepOrSubproofVerified = stepOrSubproof.verify(substitutions, assignments, context);
|
|
37
37
|
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
38
|
+
if (stepOrSubproofVerified) {
|
|
39
|
+
const stepOrSubproofUnified = stepOrSubproof.unify(substitutions, context);
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (stepOrSubproofUnified) {
|
|
42
42
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
43
43
|
|
|
44
44
|
if (assignmentsAssigned) {
|
|
45
|
-
context.
|
|
45
|
+
context.addStepOrSubproof(stepOrSubproof);
|
|
46
46
|
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
@@ -56,23 +56,23 @@ export default domAssigned(class SubDerivation {
|
|
|
56
56
|
static name = "SubDerivation";
|
|
57
57
|
|
|
58
58
|
static fromSubDerivationNode(subDerivationNode, fileContext) {
|
|
59
|
-
const
|
|
60
|
-
subDerivation = new SubDerivation(
|
|
59
|
+
const stepsOrSubproofs = stepOrSubproofFromSubDerivationNode(subDerivationNode, fileContext),
|
|
60
|
+
subDerivation = new SubDerivation(stepsOrSubproofs);
|
|
61
61
|
|
|
62
62
|
return subDerivation;
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
function
|
|
67
|
-
const {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const subproof = Subproof.
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
function stepOrSubproofFromSubDerivationNode(subDerivationNode, fileContext) {
|
|
67
|
+
const { Step, Subproof } = dom,
|
|
68
|
+
stepOrSubproofNodes = stepOrSubproofNodesQuery(subDerivationNode),
|
|
69
|
+
stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
|
|
70
|
+
const subproof = Subproof.fromStepOrSubproofNode(stepOrSubproofNode, fileContext),
|
|
71
|
+
step = Step.fromStepOrSubproofNode(stepOrSubproofNode, fileContext),
|
|
72
|
+
stepOrSubproof = (step || subproof);
|
|
73
73
|
|
|
74
|
-
return
|
|
74
|
+
return stepOrSubproof;
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
return
|
|
77
|
+
return stepsOrSubproofs;
|
|
78
78
|
}
|
package/src/dom/subproof.js
CHANGED
|
@@ -35,28 +35,28 @@ export default domAssigned(class Subproof {
|
|
|
35
35
|
return this.subDerivation;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
getLastStep() { return this.subDerivation.getLastStep(); }
|
|
39
39
|
|
|
40
40
|
getStatements() {
|
|
41
|
-
const
|
|
41
|
+
const lastStep = this.getLastStep(),
|
|
42
42
|
suppositionStatements = this.suppositions.map((supposition) => {
|
|
43
43
|
const suppositionStatement = supposition.getStatement();
|
|
44
44
|
|
|
45
45
|
return suppositionStatement;
|
|
46
46
|
}),
|
|
47
|
-
|
|
47
|
+
lastStepStatement = lastStep.getStatement(),
|
|
48
48
|
statements = [
|
|
49
49
|
...suppositionStatements,
|
|
50
|
-
|
|
50
|
+
lastStepStatement
|
|
51
51
|
];
|
|
52
52
|
|
|
53
53
|
return statements;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
const
|
|
56
|
+
isStep() {
|
|
57
|
+
const sStep = false;
|
|
58
58
|
|
|
59
|
-
return
|
|
59
|
+
return sStep;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
unifyStatement(statement, context) {
|
|
@@ -117,10 +117,10 @@ export default domAssigned(class Subproof {
|
|
|
117
117
|
|
|
118
118
|
static name = "Subproof";
|
|
119
119
|
|
|
120
|
-
static
|
|
120
|
+
static fromStepOrSubproofNode(sStepOrSubproofNode, fileContext) {
|
|
121
121
|
let subproof = null;
|
|
122
122
|
|
|
123
|
-
const subproofNode = subproofNodeQuery(
|
|
123
|
+
const subproofNode = subproofNodeQuery(sStepOrSubproofNode);
|
|
124
124
|
|
|
125
125
|
if (subproofNode !== null) {
|
|
126
126
|
const subproofString = subproofStringFromSubproofNode(subproofNode, fileContext),
|
package/src/dom/supposition.js
CHANGED
|
@@ -44,11 +44,11 @@ export default domAssigned(class Supposition {
|
|
|
44
44
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
45
45
|
|
|
46
46
|
if (assignmentsAssigned) {
|
|
47
|
-
const {
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const { Step } = dom,
|
|
48
|
+
step = Step.fromStatement(this.statement, context),
|
|
49
|
+
stepOrSubproof = step; ///
|
|
50
50
|
|
|
51
|
-
context.
|
|
51
|
+
context.addStepOrSubproof(stepOrSubproof);
|
|
52
52
|
|
|
53
53
|
verified = true;
|
|
54
54
|
}
|
|
@@ -90,51 +90,51 @@ export default domAssigned(class Supposition {
|
|
|
90
90
|
return unifiedIndependently;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
let
|
|
93
|
+
unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext) {
|
|
94
|
+
let stepOrSubproofUnified = false;
|
|
95
95
|
|
|
96
|
-
const
|
|
97
|
-
subproof =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
const stepOrSubProofStep = stepOrSubproof.isStep(),
|
|
97
|
+
subproof = stepOrSubProofStep ?
|
|
98
|
+
null :
|
|
99
|
+
stepOrSubproof,
|
|
100
|
+
step = stepOrSubProofStep ?
|
|
101
|
+
stepOrSubproof :
|
|
102
|
+
null;
|
|
103
103
|
|
|
104
104
|
substitutions.snapshot();
|
|
105
105
|
|
|
106
106
|
if (subproof !== null) {
|
|
107
107
|
const subproofUnified = this.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
stepOrSubproofUnified = subproofUnified; ///
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
if (
|
|
113
|
-
const statementUnified = this.
|
|
112
|
+
if (step !== null) {
|
|
113
|
+
const statementUnified = this.unifyStep(step, substitutions, generalContext, specificContext);
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
stepOrSubproofUnified = statementUnified; ///
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
if (
|
|
118
|
+
if (stepOrSubproofUnified) {
|
|
119
119
|
substitutions.resolve(generalContext, specificContext);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
stepOrSubproofUnified ?
|
|
123
123
|
substitutions.continue() :
|
|
124
124
|
substitutions.rollback(specificContext);
|
|
125
125
|
|
|
126
|
-
return
|
|
126
|
+
return stepOrSubproofUnified;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
let
|
|
129
|
+
unifyStep(step, substitutions, generalContext, specificContext) {
|
|
130
|
+
let stepUnified;
|
|
131
131
|
|
|
132
|
-
const statement =
|
|
132
|
+
const statement = step.getStatement(),
|
|
133
133
|
statementUnified = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
stepUnified = statementUnified; ///
|
|
136
136
|
|
|
137
|
-
return
|
|
137
|
+
return stepUnified;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
@@ -156,8 +156,8 @@ export default class TopLevelAssertion {
|
|
|
156
156
|
return deductionUnified;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
let
|
|
159
|
+
unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, substitutions, context) {
|
|
160
|
+
let statementAndStepsOrSubproofsUnified = false;
|
|
161
161
|
|
|
162
162
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
163
163
|
generalContext = localContext, ///
|
|
@@ -165,55 +165,55 @@ export default class TopLevelAssertion {
|
|
|
165
165
|
statementUnifiedWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, generalContext, specificContext);
|
|
166
166
|
|
|
167
167
|
if (statementUnifiedWithDeduction) {
|
|
168
|
-
const
|
|
168
|
+
const stepsOrSubproofsUnifiedWithSuppositions = this.unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, generalContext, specificContext);
|
|
169
169
|
|
|
170
|
-
if (
|
|
170
|
+
if (stepsOrSubproofsUnifiedWithSuppositions) {
|
|
171
171
|
const substitutionsResolved = substitutions.areResolved();
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
statementAndStepsOrSubproofsUnified = substitutionsResolved; ///
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
return
|
|
177
|
+
return statementAndStepsOrSubproofsUnified;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
let
|
|
180
|
+
unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext) {
|
|
181
|
+
let stepsOrSubproofsUnifiedWithSupposition =false;
|
|
182
182
|
|
|
183
183
|
const context = specificContext, ///
|
|
184
184
|
suppositionUnifiedIndependently = supposition.unifyIndependently(substitutions, context);
|
|
185
185
|
|
|
186
186
|
if (suppositionUnifiedIndependently) {
|
|
187
|
-
|
|
187
|
+
stepsOrSubproofsUnifiedWithSupposition = true;
|
|
188
188
|
} else {
|
|
189
|
-
const
|
|
190
|
-
const
|
|
189
|
+
const step = extract(stepsOrSubproofs, (stepOrSubproof) => {
|
|
190
|
+
const stepUnified = supposition.unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext);
|
|
191
191
|
|
|
192
|
-
if (
|
|
192
|
+
if (stepUnified) {
|
|
193
193
|
return true;
|
|
194
194
|
}
|
|
195
195
|
}) || null;
|
|
196
196
|
|
|
197
|
-
if (
|
|
198
|
-
|
|
197
|
+
if (step !== null) {
|
|
198
|
+
stepsOrSubproofsUnifiedWithSupposition = true;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
return
|
|
202
|
+
return stepsOrSubproofsUnifiedWithSupposition;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, generalContext, specificContext) {
|
|
206
|
+
stepsOrSubproofs = reverse(stepsOrSubproofs); ///
|
|
207
207
|
|
|
208
|
-
const
|
|
209
|
-
const
|
|
208
|
+
const stepsOrSubproofsUnifiedWithSuppositions = backwardsEvery(this.suppositions, (supposition) => {
|
|
209
|
+
const stepsOrSubproofsUnifiedWithSupposition = this.unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext);
|
|
210
210
|
|
|
211
|
-
if (
|
|
211
|
+
if (stepsOrSubproofsUnifiedWithSupposition) {
|
|
212
212
|
return true;
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
|
|
216
|
-
return
|
|
216
|
+
return stepsOrSubproofsUnifiedWithSuppositions;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
toJSON() {
|