occam-verify-cli 0.0.1135 → 0.0.1137
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 +9 -9
- package/lib/context/local.js +24 -23
- package/lib/dom/conclusion.js +5 -5
- package/lib/dom/consequent.js +5 -5
- package/lib/dom/derivation.js +15 -15
- package/lib/dom/premise.js +37 -28
- package/lib/dom/proofStep.js +38 -48
- package/lib/dom/proofStep.old.js +246 -0
- package/lib/dom/reference.js +2 -2
- package/lib/dom/rule.js +23 -23
- package/lib/dom/statement.js +5 -5
- package/lib/dom/subDerivation.js +15 -15
- package/lib/dom/subproof.js +53 -5
- package/lib/dom/supposition.js +37 -28
- package/lib/dom/topLevelAssertion.js +23 -23
- package/lib/mixins/proofStep/unify.js +6 -6
- package/lib/utilities/subproof.js +3 -8
- package/package.json +1 -1
- package/src/context/file.js +6 -6
- package/src/context/local.js +28 -26
- package/src/dom/conclusion.js +6 -5
- package/src/dom/consequent.js +6 -6
- package/src/dom/derivation.js +19 -16
- package/src/dom/premise.js +53 -36
- package/src/dom/proofStep.js +44 -57
- package/src/dom/proofStep.old.js +183 -0
- package/src/dom/reference.js +1 -1
- package/src/dom/rule.js +19 -19
- package/src/dom/statement.js +3 -3
- package/src/dom/subDerivation.js +19 -16
- package/src/dom/subproof.js +62 -3
- package/src/dom/supposition.js +49 -32
- package/src/dom/topLevelAssertion.js +19 -19
- package/src/mixins/proofStep/unify.js +8 -8
- package/src/utilities/subproof.js +4 -11
package/src/dom/premise.js
CHANGED
|
@@ -31,69 +31,67 @@ export default domAssigned(class Premise {
|
|
|
31
31
|
return unifiedIndependently;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
let
|
|
34
|
+
unifyProofStepSubproof(proofStepSubproof, substitutions, generalContext, specificContext) {
|
|
35
|
+
let proofStepSubproofUnified = false;
|
|
36
36
|
|
|
37
|
-
const
|
|
38
|
-
|
|
37
|
+
const proofStepSubProofProofStep = proofStepSubproof.isProofStep(),
|
|
38
|
+
subproof = proofStepSubProofProofStep ?
|
|
39
|
+
null :
|
|
40
|
+
proofStepSubproof,
|
|
41
|
+
proofStep = proofStepSubProofProofStep ?
|
|
42
|
+
proofStepSubproof :
|
|
43
|
+
null;
|
|
39
44
|
|
|
40
45
|
substitutions.snapshot();
|
|
41
46
|
|
|
42
47
|
if (subproof !== null) {
|
|
43
48
|
const subproofUnified = this.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
proofStepSubproofUnified = subproofUnified; ///
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
if (
|
|
49
|
-
const statementUnified = this.
|
|
53
|
+
if (proofStep !== null) {
|
|
54
|
+
const statementUnified = this.unifyProofStep(proofStep, substitutions, generalContext, specificContext);
|
|
50
55
|
|
|
51
|
-
|
|
56
|
+
proofStepSubproofUnified = statementUnified; ///
|
|
52
57
|
}
|
|
53
58
|
|
|
54
|
-
if (
|
|
59
|
+
if (proofStepSubproofUnified) {
|
|
55
60
|
substitutions.resolve(generalContext, specificContext);
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
const context = specificContext; ///
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
proofStepSubproofUnified ?
|
|
61
66
|
substitutions.continue() :
|
|
62
67
|
substitutions.rollback(context);
|
|
63
68
|
|
|
64
|
-
return
|
|
69
|
+
return proofStepSubproofUnified;
|
|
65
70
|
}
|
|
66
71
|
|
|
67
|
-
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
const premise = this, ///
|
|
71
|
-
premiseString = premise.getString(),
|
|
72
|
-
statementString = statement.getString();
|
|
72
|
+
unifyProofStep(proofStep, substitutions, generalContext, specificContext) {
|
|
73
|
+
let proofStepUnified;
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
const statement = proofStep.getStatement(),
|
|
76
|
+
statementUnified = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
proofStepUnified = statementUnified; ///
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
specificContext.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return statementUnified;
|
|
80
|
+
return proofStepUnified;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
86
84
|
let subproofUnified = false;
|
|
87
85
|
|
|
88
86
|
const premise = this, ///
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
subproofString = subproof.getString(),
|
|
88
|
+
premiseStatement = premise.getStatement(),
|
|
89
|
+
premiseStatementString = premiseStatement.getString();
|
|
92
90
|
|
|
93
91
|
specificContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
|
|
94
92
|
|
|
95
93
|
const context = generalContext,
|
|
96
|
-
|
|
94
|
+
subproofAssertion = subproofAssertionFromStatement(this.statement, context);
|
|
97
95
|
|
|
98
96
|
if (subproofAssertion !== null) {
|
|
99
97
|
subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
@@ -106,14 +104,32 @@ export default domAssigned(class Premise {
|
|
|
106
104
|
return subproofUnified;
|
|
107
105
|
}
|
|
108
106
|
|
|
107
|
+
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
108
|
+
let statementUnified;
|
|
109
|
+
|
|
110
|
+
const premise = this, ///
|
|
111
|
+
premiseString = premise.getString(),
|
|
112
|
+
statementString = statement.getString();
|
|
113
|
+
|
|
114
|
+
specificContext.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`);
|
|
115
|
+
|
|
116
|
+
statementUnified = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
117
|
+
|
|
118
|
+
if (statementUnified) {
|
|
119
|
+
specificContext.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return statementUnified;
|
|
123
|
+
}
|
|
124
|
+
|
|
109
125
|
verify(context) {
|
|
110
126
|
let verified = false;
|
|
111
127
|
|
|
112
128
|
const premiseString = this.string; ///
|
|
113
129
|
|
|
114
|
-
|
|
115
|
-
context.trace(`Verifying the '${premiseString}' premise...`);
|
|
130
|
+
context.trace(`Verifying the '${premiseString}' premise...`);
|
|
116
131
|
|
|
132
|
+
if (this.statement !== null) {
|
|
117
133
|
const stated = true,
|
|
118
134
|
assignments = [],
|
|
119
135
|
statementVerified = this.statement.verify(assignments, stated, context);
|
|
@@ -123,21 +139,22 @@ export default domAssigned(class Premise {
|
|
|
123
139
|
|
|
124
140
|
if (assignmentsAssigned) {
|
|
125
141
|
const { ProofStep } = dom,
|
|
126
|
-
proofStep = ProofStep.fromStatement(this.statement, context)
|
|
142
|
+
proofStep = ProofStep.fromStatement(this.statement, context),
|
|
143
|
+
proofStepSubproof = proofStep; ///
|
|
127
144
|
|
|
128
|
-
context.
|
|
145
|
+
context.addProofStepSubproof(proofStepSubproof);
|
|
129
146
|
|
|
130
147
|
verified = true;
|
|
131
148
|
}
|
|
132
149
|
}
|
|
133
|
-
|
|
134
|
-
if (verified) {
|
|
135
|
-
context.debug(`...verified the '${premiseString}' premise.`);
|
|
136
|
-
}
|
|
137
150
|
} else {
|
|
138
151
|
context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`);
|
|
139
152
|
}
|
|
140
153
|
|
|
154
|
+
if (verified) {
|
|
155
|
+
context.debug(`...verified the '${premiseString}' premise.`);
|
|
156
|
+
}
|
|
157
|
+
|
|
141
158
|
return verified;
|
|
142
159
|
}
|
|
143
160
|
|
package/src/dom/proofStep.js
CHANGED
|
@@ -4,13 +4,15 @@ import dom from "../dom";
|
|
|
4
4
|
import unifyMixins from "../mixins/proofStep/unify";
|
|
5
5
|
import Substitutions from "../substitutions";
|
|
6
6
|
|
|
7
|
+
import { nodeQuery } from "../utilities/query";
|
|
7
8
|
import { domAssigned } from "../dom";
|
|
8
9
|
import { assignAssignments } from "../utilities/assignments";
|
|
9
10
|
|
|
11
|
+
const proofStepNodeQuery = nodeQuery("/proofStep");
|
|
12
|
+
|
|
10
13
|
export default domAssigned(class ProofStep {
|
|
11
|
-
constructor(string,
|
|
14
|
+
constructor(string, statement, reference) {
|
|
12
15
|
this.string = string;
|
|
13
|
-
this.subproof = subproof;
|
|
14
16
|
this.statement = statement;
|
|
15
17
|
this.reference = reference;
|
|
16
18
|
}
|
|
@@ -19,10 +21,6 @@ export default domAssigned(class ProofStep {
|
|
|
19
21
|
return this.string;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
getSubproof() {
|
|
23
|
-
return this.subproof;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
24
|
getStatement() {
|
|
27
25
|
return this.statement;
|
|
28
26
|
}
|
|
@@ -37,29 +35,29 @@ export default domAssigned(class ProofStep {
|
|
|
37
35
|
return qualified;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
isProofStep() {
|
|
39
|
+
const proofStep = true;
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
41
|
+
return proofStep;
|
|
42
|
+
}
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
unify(substitutions, context) {
|
|
45
|
+
let unified;
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
const proofStepString = this.string; ///
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
const unified = unifyMixin(this.statement, this.reference, substitutions, context);
|
|
49
|
+
context.trace(`Unifying the '${proofStepString}' proof step...`);
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
});
|
|
51
|
+
unified = unifyMixins.some((unifyMixin) => {
|
|
52
|
+
const unified = unifyMixin(this.statement, this.reference, substitutions, context);
|
|
59
53
|
|
|
60
54
|
if (unified) {
|
|
61
|
-
|
|
55
|
+
return true;
|
|
62
56
|
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (unified) {
|
|
60
|
+
context.debug(`...unified the '${proofStepString}' proof step.`);
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
return unified;
|
|
@@ -72,15 +70,7 @@ export default domAssigned(class ProofStep {
|
|
|
72
70
|
generalContext = context, ///
|
|
73
71
|
substitutions = Substitutions.fromNothing();
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
const subproofUnified = statement.unifySubproof(this.subproof, substitutions, generalContext, specificContext);
|
|
77
|
-
|
|
78
|
-
statementUnified = subproofUnified; ///
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (this.statement !== null) {
|
|
82
|
-
statementUnified = statement.unifyStatement(this.statement, substitutions, generalContext, specificContext);
|
|
83
|
-
}
|
|
73
|
+
statementUnified = statement.unifyStatement(this.statement, substitutions, generalContext, specificContext);
|
|
84
74
|
|
|
85
75
|
if (statementUnified) {
|
|
86
76
|
const equivalences = context.getEquivalences(),
|
|
@@ -105,9 +95,9 @@ export default domAssigned(class ProofStep {
|
|
|
105
95
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
106
96
|
|
|
107
97
|
if (assignmentsAssigned) {
|
|
108
|
-
const
|
|
98
|
+
const proofStepSubproof = this; ///
|
|
109
99
|
|
|
110
|
-
context.
|
|
100
|
+
context.addProofStepSubproof(proofStepSubproof);
|
|
111
101
|
|
|
112
102
|
verifiedAndUnified = true; ///
|
|
113
103
|
}
|
|
@@ -120,17 +110,11 @@ export default domAssigned(class ProofStep {
|
|
|
120
110
|
verify(substitutions, assignments, context) {
|
|
121
111
|
let verified = false;
|
|
122
112
|
|
|
123
|
-
|
|
124
|
-
///
|
|
125
|
-
} else if (this.subproof !== null) {
|
|
126
|
-
const subproofVerified = this.subproof.verify(substitutions, context);
|
|
127
|
-
|
|
128
|
-
verified = subproofVerified; ///
|
|
129
|
-
} else if (this.statement !== null) {
|
|
130
|
-
const proofStepString = this.string; ///
|
|
113
|
+
const proofStepString = this.string;
|
|
131
114
|
|
|
132
|
-
|
|
115
|
+
context.trace(`Verifying the '${proofStepString}' proof step...`);
|
|
133
116
|
|
|
117
|
+
if (this.statement !== null) {
|
|
134
118
|
const qualified = this.isQualified(),
|
|
135
119
|
stated = qualified, ///
|
|
136
120
|
statementVerified = this.statement.verify(assignments, stated, context);
|
|
@@ -144,16 +128,14 @@ export default domAssigned(class ProofStep {
|
|
|
144
128
|
verified = referenceVerified; ///
|
|
145
129
|
}
|
|
146
130
|
}
|
|
147
|
-
|
|
148
|
-
if (verified) {
|
|
149
|
-
context.debug(`...verified the '${proofStepString}' proof step.`);
|
|
150
|
-
}
|
|
151
131
|
} else {
|
|
152
|
-
const proofStepString = this.string;
|
|
153
|
-
|
|
154
132
|
context.debug(`Cannot verify the '${proofStepString}' proof step because it is nonsense.`);
|
|
155
133
|
}
|
|
156
134
|
|
|
135
|
+
if (verified) {
|
|
136
|
+
context.debug(`...verified the '${proofStepString}' proof step.`);
|
|
137
|
+
}
|
|
138
|
+
|
|
157
139
|
return verified;
|
|
158
140
|
}
|
|
159
141
|
|
|
@@ -162,21 +144,26 @@ export default domAssigned(class ProofStep {
|
|
|
162
144
|
static fromStatement(statement, context) {
|
|
163
145
|
const statementString = statement.getString(),
|
|
164
146
|
string = statementString, ///
|
|
165
|
-
subproof = null,
|
|
166
147
|
reference = null,
|
|
167
|
-
proofStep = new ProofStep(string,
|
|
148
|
+
proofStep = new ProofStep(string, statement, reference);
|
|
168
149
|
|
|
169
150
|
return proofStep;
|
|
170
151
|
}
|
|
171
152
|
|
|
172
|
-
static
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
153
|
+
static fromProofStepSubproofNode(proofStepSubproofNode, fileContext) {
|
|
154
|
+
let proofStep = null;
|
|
155
|
+
|
|
156
|
+
const proofStepNode = proofStepNodeQuery(proofStepSubproofNode);
|
|
157
|
+
|
|
158
|
+
if (proofStepNode !== null) {
|
|
159
|
+
const { Statement, Reference } = dom,
|
|
160
|
+
node = proofStepNode, ///
|
|
161
|
+
string = fileContext.nodeAsString(node),
|
|
162
|
+
statement = Statement.fromProofStepNode(proofStepNode, fileContext),
|
|
163
|
+
reference = Reference.fromProofStepNode(proofStepNode, fileContext);
|
|
164
|
+
|
|
165
|
+
proofStep = new ProofStep(string, statement, reference);
|
|
166
|
+
}
|
|
180
167
|
|
|
181
168
|
return proofStep;
|
|
182
169
|
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import dom from "../dom";
|
|
4
|
+
import unifyMixins from "../mixins/proofStep/unify";
|
|
5
|
+
import Substitutions from "../substitutions";
|
|
6
|
+
|
|
7
|
+
import { domAssigned } from "../dom";
|
|
8
|
+
import { assignAssignments } from "../utilities/assignments";
|
|
9
|
+
|
|
10
|
+
export default domAssigned(class ProofStep {
|
|
11
|
+
constructor(string, subproof, statement, reference) {
|
|
12
|
+
this.string = string;
|
|
13
|
+
this.subproof = subproof;
|
|
14
|
+
this.statement = statement;
|
|
15
|
+
this.reference = reference;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getString() {
|
|
19
|
+
return this.string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getSubproof() {
|
|
23
|
+
return this.subproof;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getStatement() {
|
|
27
|
+
return this.statement;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getReference() {
|
|
31
|
+
return this.reference;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
isQualified() {
|
|
35
|
+
const qualified = (this.reference !== null);
|
|
36
|
+
|
|
37
|
+
return qualified;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
unify(substitutions, context) {
|
|
41
|
+
let unified;
|
|
42
|
+
|
|
43
|
+
if (this.subproof !== null) {
|
|
44
|
+
unified = true; ///
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (this.statement !== null) {
|
|
48
|
+
const proofStepString = this.string; ///
|
|
49
|
+
|
|
50
|
+
context.trace(`Unifying the '${proofStepString}' proof step...`);
|
|
51
|
+
|
|
52
|
+
unified = unifyMixins.some((unifyMixin) => {
|
|
53
|
+
const unified = unifyMixin(this.statement, this.reference, substitutions, context);
|
|
54
|
+
|
|
55
|
+
if (unified) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (unified) {
|
|
61
|
+
context.debug(`...unified the '${proofStepString}' proof step.`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return unified;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
unifyStatement(statement, context) {
|
|
69
|
+
let statementUnified;
|
|
70
|
+
|
|
71
|
+
const specificContext = context, ///
|
|
72
|
+
generalContext = context, ///
|
|
73
|
+
substitutions = Substitutions.fromNothing();
|
|
74
|
+
|
|
75
|
+
if (this.subproof !== null) {
|
|
76
|
+
const subproofUnified = statement.unifySubproof(this.subproof, substitutions, generalContext, specificContext);
|
|
77
|
+
|
|
78
|
+
statementUnified = subproofUnified; ///
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this.statement !== null) {
|
|
82
|
+
statementUnified = statement.unifyStatement(this.statement, substitutions, generalContext, specificContext);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (statementUnified) {
|
|
86
|
+
const equivalences = context.getEquivalences(),
|
|
87
|
+
substitutionsUnified = equivalences.unifySubstitutions(substitutions);
|
|
88
|
+
|
|
89
|
+
statementUnified = substitutionsUnified; ///
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return statementUnified;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
verifyAndUnify(substitutions, context) {
|
|
96
|
+
let verifiedAndUnified = false;
|
|
97
|
+
|
|
98
|
+
const assignments = [],
|
|
99
|
+
verified = this.verify(substitutions, assignments, context);
|
|
100
|
+
|
|
101
|
+
if (verified) {
|
|
102
|
+
const unified = this.unify(substitutions, context);
|
|
103
|
+
|
|
104
|
+
if (unified) {
|
|
105
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
106
|
+
|
|
107
|
+
if (assignmentsAssigned) {
|
|
108
|
+
const proofStep = this; ///
|
|
109
|
+
|
|
110
|
+
context.addProofStep(proofStep);
|
|
111
|
+
|
|
112
|
+
verifiedAndUnified = true; ///
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return verifiedAndUnified;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
verify(substitutions, assignments, context) {
|
|
121
|
+
let verified = false;
|
|
122
|
+
|
|
123
|
+
if (false) {
|
|
124
|
+
///
|
|
125
|
+
} else if (this.subproof !== null) {
|
|
126
|
+
const subproofVerified = this.subproof.verify(substitutions, context);
|
|
127
|
+
|
|
128
|
+
verified = subproofVerified; ///
|
|
129
|
+
} else if (this.statement !== null) {
|
|
130
|
+
const proofStepString = this.string; ///
|
|
131
|
+
|
|
132
|
+
context.trace(`Verifying the '${proofStepString}' proof step...`);
|
|
133
|
+
|
|
134
|
+
const qualified = this.isQualified(),
|
|
135
|
+
stated = qualified, ///
|
|
136
|
+
statementVerified = this.statement.verify(assignments, stated, context);
|
|
137
|
+
|
|
138
|
+
if (statementVerified) {
|
|
139
|
+
if (this.reference === null) {
|
|
140
|
+
verified = true;
|
|
141
|
+
} else {
|
|
142
|
+
const referenceVerified = this.reference.verify(context);
|
|
143
|
+
|
|
144
|
+
verified = referenceVerified; ///
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (verified) {
|
|
149
|
+
context.debug(`...verified the '${proofStepString}' proof step.`);
|
|
150
|
+
}
|
|
151
|
+
} else {
|
|
152
|
+
const proofStepString = this.string;
|
|
153
|
+
|
|
154
|
+
context.debug(`Cannot verify the '${proofStepString}' proof step because it is nonsense.`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return verified;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static name = "ProofStep";
|
|
161
|
+
|
|
162
|
+
static fromStatement(statement, context) {
|
|
163
|
+
const statementString = statement.getString(),
|
|
164
|
+
string = statementString, ///
|
|
165
|
+
subproof = null,
|
|
166
|
+
reference = null,
|
|
167
|
+
proofStep = new ProofStep(string, subproof, statement, reference);
|
|
168
|
+
|
|
169
|
+
return proofStep;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static fromProofStepNode(proofStepNode, fileContext) {
|
|
173
|
+
const { Subproof, Statement, Reference } = dom,
|
|
174
|
+
node = proofStepNode, ///
|
|
175
|
+
string = fileContext.nodeAsString(node),
|
|
176
|
+
subproof = Subproof.fromProofStepNode(proofStepNode, fileContext),
|
|
177
|
+
statement = Statement.fromProofStepNode(proofStepNode, fileContext),
|
|
178
|
+
reference = Reference.fromProofStepNode(proofStepNode, fileContext),
|
|
179
|
+
proofStep = new ProofStep(string, subproof, statement, reference);
|
|
180
|
+
|
|
181
|
+
return proofStep;
|
|
182
|
+
}
|
|
183
|
+
});
|
package/src/dom/reference.js
CHANGED
|
@@ -9,7 +9,7 @@ import { referenceMetaType } from "../dom/metaType";
|
|
|
9
9
|
import { unifyLabelWithReference } from "../utilities/unification";
|
|
10
10
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
11
11
|
|
|
12
|
-
const proofStepReferenceNodeQuery = nodeQuery("/proofStep
|
|
12
|
+
const proofStepReferenceNodeQuery = nodeQuery("/proofStep/reference"),
|
|
13
13
|
declarationReferenceNodeQuery = nodeQuery("/declaration/reference");
|
|
14
14
|
|
|
15
15
|
export default domAssigned(class Reference {
|
package/src/dom/rule.js
CHANGED
|
@@ -71,8 +71,8 @@ export default domAssigned(class Rule {
|
|
|
71
71
|
return metavariableNameMatches;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
let
|
|
74
|
+
unifyStatementAndProofStepSubproofs(statement, proofStepSubproofs, context) {
|
|
75
|
+
let statementAndProofStepSubproofsUnified = false;
|
|
76
76
|
|
|
77
77
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
78
78
|
generalContext = localContext, ///
|
|
@@ -82,16 +82,16 @@ export default domAssigned(class Rule {
|
|
|
82
82
|
statementUnifiedWithConclusion = this.unifyStatementWithConclusion(statement, substitutions, generalContext, specificContext);
|
|
83
83
|
|
|
84
84
|
if (statementUnifiedWithConclusion) {
|
|
85
|
-
const
|
|
85
|
+
const proofStepSubproofsUnifiedWithPremises = this.unifyProofStepSubproofsWithPremises(proofStepSubproofs, substitutions, generalContext, specificContext);
|
|
86
86
|
|
|
87
|
-
if (
|
|
87
|
+
if (proofStepSubproofsUnifiedWithPremises) {
|
|
88
88
|
const substitutionsResolved = substitutions.areResolved();
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
statementAndProofStepSubproofsUnified = substitutionsResolved; ///
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
return
|
|
94
|
+
return statementAndProofStepSubproofsUnified;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
unifyStatementWithConclusion(statement, substitutions, generalContext, specificContext) {
|
|
@@ -104,42 +104,42 @@ export default domAssigned(class Rule {
|
|
|
104
104
|
return statementUnifiedWithConclusion;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
unifyProofStepSubproofsWithPremises(proofStepSubproofs, substitutions, generalContext, specificContext) {
|
|
108
|
+
proofStepSubproofs = reverse(proofStepSubproofs); ///
|
|
109
109
|
|
|
110
|
-
const
|
|
111
|
-
const proofStepUnifiedWithPremise = this.
|
|
110
|
+
const proofStepSubproofsUnifiedWithPremises = backwardsEvery(this.premises, (premise) => {
|
|
111
|
+
const proofStepUnifiedWithPremise = this.unifyProofStepSubproofsWithPremise(proofStepSubproofs, premise, substitutions, generalContext, specificContext);
|
|
112
112
|
|
|
113
113
|
if (proofStepUnifiedWithPremise) {
|
|
114
114
|
return true;
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
return
|
|
118
|
+
return proofStepSubproofsUnifiedWithPremises;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
let
|
|
121
|
+
unifyProofStepSubproofsWithPremise(proofStepSubproofs, premise, substitutions, generalContext, specificContext) {
|
|
122
|
+
let proofStepSubproofsUnifiedWithPremise =false;
|
|
123
123
|
|
|
124
124
|
const premiseUnifiedIndependently = premise.unifyIndependently(substitutions, generalContext, specificContext);
|
|
125
125
|
|
|
126
126
|
if (premiseUnifiedIndependently) {
|
|
127
|
-
|
|
127
|
+
proofStepSubproofsUnifiedWithPremise = true;
|
|
128
128
|
} else {
|
|
129
|
-
const proofStep = extract(
|
|
130
|
-
const
|
|
129
|
+
const proofStep = extract(proofStepSubproofs, (proofStepSubproof) => {
|
|
130
|
+
const proofStepSubproofUnified = premise.unifyProofStepSubproof(proofStepSubproof, substitutions, generalContext, specificContext);
|
|
131
131
|
|
|
132
|
-
if (
|
|
132
|
+
if (proofStepSubproofUnified) {
|
|
133
133
|
return true;
|
|
134
134
|
}
|
|
135
135
|
}) || null;
|
|
136
136
|
|
|
137
137
|
if (proofStep !== null) {
|
|
138
|
-
|
|
138
|
+
proofStepSubproofsUnifiedWithPremise = true;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
return
|
|
142
|
+
return proofStepSubproofsUnifiedWithPremise;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
verify() {
|
package/src/dom/statement.js
CHANGED
|
@@ -192,12 +192,12 @@ export default domAssigned(class Statement {
|
|
|
192
192
|
return unifiedIndependently;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
unifyWithProofStepSubproofs(proofStepSubproofs, context) {
|
|
196
196
|
let unifiedWithProofSteps;
|
|
197
197
|
|
|
198
|
-
unifiedWithProofSteps = backwardsSome(
|
|
198
|
+
unifiedWithProofSteps = backwardsSome(proofStepSubproofs, (proofStepSubproof) => {
|
|
199
199
|
const statement = this, ///
|
|
200
|
-
statementUnified =
|
|
200
|
+
statementUnified =proofStepSubproof.unifyStatement(statement, context);
|
|
201
201
|
|
|
202
202
|
if (statementUnified) {
|
|
203
203
|
return true;
|