occam-verify-cli 1.0.211 → 1.0.219
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/dom/assertion/satisfies.js +17 -17
- package/lib/dom/axiom.js +81 -57
- package/lib/dom/deduction.js +15 -1
- package/lib/dom/metavariable.js +1 -1
- package/lib/dom/rule.js +3 -3
- package/lib/dom/step.js +25 -3
- package/lib/dom/subproof.js +38 -16
- package/lib/dom/substitution/term.js +8 -1
- package/lib/dom/substitution.js +8 -1
- package/lib/dom/supposition.js +15 -1
- package/lib/dom/term.js +1 -1
- package/lib/dom/topLevelAssertion.js +19 -5
- package/lib/dom/variable.js +9 -28
- package/lib/mixins/step/unify.js +41 -26
- package/lib/node/conclusion.js +8 -1
- package/lib/node/deduction.js +8 -1
- package/lib/node/nonsense.js +107 -0
- package/lib/node/premise.js +8 -1
- package/lib/node/step.js +8 -1
- package/lib/node/supposition.js +8 -1
- package/lib/nonTerminalNodeMap.js +3 -2
- package/lib/ruleNames.js +5 -1
- package/lib/substitutions.js +12 -1
- package/lib/utilities/subproof.js +26 -12
- package/package.json +1 -1
- package/src/dom/assertion/satisfies.js +18 -21
- package/src/dom/axiom.js +116 -79
- package/src/dom/deduction.js +22 -0
- package/src/dom/metavariable.js +1 -1
- package/src/dom/rule.js +2 -2
- package/src/dom/step.js +37 -3
- package/src/dom/subproof.js +55 -23
- package/src/dom/substitution/term.js +8 -0
- package/src/dom/substitution.js +6 -0
- package/src/dom/supposition.js +22 -0
- package/src/dom/term.js +1 -1
- package/src/dom/topLevelAssertion.js +18 -5
- package/src/dom/variable.js +17 -40
- package/src/mixins/step/unify.js +49 -28
- package/src/node/conclusion.js +8 -1
- package/src/node/deduction.js +8 -1
- package/src/node/nonsense.js +7 -0
- package/src/node/premise.js +8 -1
- package/src/node/step.js +8 -1
- package/src/node/supposition.js +8 -1
- package/src/nonTerminalNodeMap.js +3 -0
- package/src/ruleNames.js +1 -0
- package/src/substitutions.js +10 -0
- package/src/utilities/subproof.js +43 -21
package/src/dom/axiom.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
3
|
import LocalContext from "../context/local";
|
|
6
4
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
7
5
|
|
|
8
6
|
import { domAssigned } from "../dom";
|
|
9
7
|
|
|
10
|
-
const { match } = arrayUtilities;
|
|
11
|
-
|
|
12
8
|
export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
13
9
|
isSatisfiable() {
|
|
14
10
|
const signature = this.getSignature(),
|
|
@@ -60,7 +56,7 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
60
56
|
return signatureVerified;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
|
-
matchSignature(signature, substitutions,
|
|
59
|
+
matchSignature(signature, substitutions, context) {
|
|
64
60
|
let signatureMatches = false;
|
|
65
61
|
|
|
66
62
|
const satisfiable = this.isSatisfiable();
|
|
@@ -72,138 +68,179 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
72
68
|
|
|
73
69
|
const signatureB = signature; ///
|
|
74
70
|
|
|
71
|
+
const fileContext = this.getFileContext(),
|
|
72
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
73
|
+
generalContext = localContext, ///
|
|
74
|
+
specificContext = context; ///
|
|
75
|
+
|
|
75
76
|
signatureMatches = signatureA.match(signatureB, substitutions, generalContext, specificContext);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
return signatureMatches;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
statementUnified = deduction.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
82
|
+
unifyStep(step, substitutions, generalContext, specificContext) {
|
|
83
|
+
let stepUnified = false;
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
const context = specificContext, ///
|
|
86
|
+
stepString = step.getString(),
|
|
87
|
+
axiomString = this.string; ///
|
|
88
|
+
|
|
89
|
+
context.trace(`Unifying the '${stepString}' step with the '${axiomString}' axiom...`);
|
|
90
|
+
|
|
91
|
+
const statement = step.getStatement(),
|
|
92
|
+
statementUnified = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
93
|
+
|
|
94
|
+
if (statementUnified) {
|
|
95
|
+
stepUnified = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (stepUnified) {
|
|
99
|
+
context.debug(`...unified the '${stepString}' step with the '${axiomString}' axiom.`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return stepUnified;
|
|
86
103
|
}
|
|
87
104
|
|
|
88
|
-
|
|
89
|
-
let
|
|
105
|
+
unifyLastStep(lastStep, substitutions, generalContext, specificContext) {
|
|
106
|
+
let lastStepUnified = false;
|
|
90
107
|
|
|
91
108
|
const context = specificContext, ///
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
axiomString = this.string, ///
|
|
110
|
+
lastStepString = lastStep.getString();
|
|
94
111
|
|
|
95
|
-
context.trace(`Unifying the '${
|
|
112
|
+
context.trace(`Unifying the '${lastStepString}' last step with the '${axiomString}' axiom...`)
|
|
96
113
|
|
|
97
|
-
const
|
|
98
|
-
|
|
114
|
+
const step = lastStep, ///
|
|
115
|
+
stepUnified = this.unifyStep(step, substitutions, generalContext, specificContext);
|
|
99
116
|
|
|
100
|
-
|
|
117
|
+
if (stepUnified) {
|
|
118
|
+
lastStepUnified = true;
|
|
119
|
+
}
|
|
101
120
|
|
|
102
|
-
if (
|
|
103
|
-
context.debug(`...unified the '${
|
|
121
|
+
if (lastStepUnified) {
|
|
122
|
+
context.debug(`...unified the '${lastStepString}' last step with the '${axiomString}' axiom.`)
|
|
104
123
|
}
|
|
105
124
|
|
|
106
|
-
return
|
|
125
|
+
return lastStepUnified;
|
|
107
126
|
}
|
|
108
127
|
|
|
109
|
-
|
|
110
|
-
let
|
|
128
|
+
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
129
|
+
let subproofUnified = false;
|
|
111
130
|
|
|
112
131
|
const context = specificContext, ///
|
|
113
|
-
|
|
114
|
-
|
|
132
|
+
axiomString = this.string, ///
|
|
133
|
+
subproofString = subproof.getString();
|
|
115
134
|
|
|
116
|
-
context.trace(`Unifying the '${
|
|
135
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${axiomString}' axiom...`);
|
|
117
136
|
|
|
118
|
-
const
|
|
119
|
-
|
|
137
|
+
const lastStep = subproof.getLastStep(),
|
|
138
|
+
lastStepUnified = this.unifyLastStep(lastStep, substitutions, generalContext, specificContext);
|
|
120
139
|
|
|
121
|
-
|
|
140
|
+
if (lastStepUnified) {
|
|
141
|
+
const suppositions = subproof.getSuppositions(),
|
|
142
|
+
suppositionsUnified = this.unifySuppositions(suppositions, substitutions, generalContext, specificContext);
|
|
122
143
|
|
|
123
|
-
|
|
124
|
-
|
|
144
|
+
if (suppositionsUnified) {
|
|
145
|
+
subproofUnified = true;
|
|
146
|
+
}
|
|
125
147
|
}
|
|
126
148
|
|
|
127
|
-
|
|
149
|
+
if (subproofUnified) {
|
|
150
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${axiomString}' axiom.`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return subproofUnified;
|
|
128
154
|
}
|
|
129
155
|
|
|
130
|
-
|
|
131
|
-
let
|
|
156
|
+
unifyDeduction(deduction, substitutions, generalContext, specificContext) {
|
|
157
|
+
let deductionUnified;
|
|
132
158
|
|
|
133
|
-
const
|
|
134
|
-
const suppositionUnified = this.unifySupposition(generalSupposition, specificSupposition, substitutions, generalContext, specificContext);
|
|
159
|
+
const specificDeduction = deduction; ///
|
|
135
160
|
|
|
136
|
-
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
161
|
+
deduction = this.getDeduction();
|
|
140
162
|
|
|
141
|
-
|
|
163
|
+
const generalDeduction = deduction; ///
|
|
142
164
|
|
|
143
|
-
|
|
144
|
-
}
|
|
165
|
+
deduction = specificDeduction; ///
|
|
145
166
|
|
|
146
|
-
|
|
147
|
-
let axiomLemmaTheoremConjectureUnified = false;
|
|
167
|
+
deductionUnified = generalDeduction.unifyDeduction(deduction, substitutions, generalContext, specificContext);
|
|
148
168
|
|
|
149
|
-
|
|
150
|
-
|
|
169
|
+
return deductionUnified;
|
|
170
|
+
}
|
|
151
171
|
|
|
152
|
-
|
|
172
|
+
unifySupposition(supposition, index, substitutions, generalContext, specificContext) {
|
|
173
|
+
let suppositionUnified;
|
|
153
174
|
|
|
154
|
-
const
|
|
155
|
-
generalContext = fileContext, ///
|
|
156
|
-
specificContext = context; ///
|
|
175
|
+
const specificSupposition = supposition; ///
|
|
157
176
|
|
|
158
|
-
|
|
177
|
+
supposition = this.getSupposition(index);
|
|
159
178
|
|
|
160
|
-
|
|
179
|
+
const generalSupposition = supposition; ///
|
|
161
180
|
|
|
162
|
-
|
|
181
|
+
supposition = specificSupposition; ///
|
|
163
182
|
|
|
164
|
-
|
|
183
|
+
suppositionUnified = generalSupposition.unifySupposition(supposition, substitutions, generalContext, specificContext);
|
|
165
184
|
|
|
166
|
-
|
|
167
|
-
|
|
185
|
+
return suppositionUnified;
|
|
186
|
+
}
|
|
168
187
|
|
|
169
|
-
|
|
170
|
-
|
|
188
|
+
unifySuppositions(suppositions, substitutions, generalContext, specificContext) {
|
|
189
|
+
let suppositionsUnified = false;
|
|
171
190
|
|
|
172
|
-
|
|
191
|
+
const specificSuppositions = suppositions; ///
|
|
173
192
|
|
|
174
|
-
|
|
193
|
+
suppositions = this.getSuppositions();
|
|
175
194
|
|
|
176
|
-
|
|
195
|
+
const generalSuppositions = suppositions, ///
|
|
196
|
+
generalSuppositionsLength = generalSuppositions.length,
|
|
197
|
+
specificSuppositionsLength = specificSuppositions.length;
|
|
177
198
|
|
|
178
|
-
|
|
179
|
-
|
|
199
|
+
if (generalSuppositionsLength === specificSuppositionsLength) {
|
|
200
|
+
suppositions = specificSuppositions; ///
|
|
180
201
|
|
|
181
|
-
|
|
182
|
-
|
|
202
|
+
const suppositionsMatch = suppositions.every((supposition, index) => {
|
|
203
|
+
const suppositionUnified = this.unifySupposition(supposition, index, substitutions, generalContext, specificContext);
|
|
183
204
|
|
|
184
|
-
|
|
185
|
-
|
|
205
|
+
if (suppositionUnified) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
if (suppositionsMatch) {
|
|
211
|
+
suppositionsUnified = true;
|
|
212
|
+
}
|
|
186
213
|
}
|
|
187
214
|
|
|
188
|
-
return
|
|
215
|
+
return suppositionsUnified;
|
|
189
216
|
}
|
|
190
217
|
|
|
191
|
-
|
|
192
|
-
let
|
|
218
|
+
unifyAxiomLemmaTheoremConjecture(axiomLemmaTheoremConjecture, substitutions, context) {
|
|
219
|
+
let axiomLemmaTheoremConjectureUnified = false;
|
|
193
220
|
|
|
194
|
-
const
|
|
221
|
+
const axiomString = this.getString(),
|
|
222
|
+
axiomLemmaTheoremConjectureString = axiomLemmaTheoremConjecture.getString();
|
|
195
223
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
224
|
+
context.trace(`Unifying the '${axiomLemmaTheoremConjectureString}' axiom, lemma, theorem or conjecture with the '${axiomString}' axiom...`);
|
|
225
|
+
|
|
226
|
+
const deduction = axiomLemmaTheoremConjecture.getDeduction(), ///
|
|
227
|
+
fileContext = this.getFileContext(),
|
|
228
|
+
generalContext = fileContext, ///
|
|
229
|
+
specificContext = context, ///
|
|
230
|
+
deductionUnified = this.unifyDeduction(deduction, substitutions, generalContext, specificContext);
|
|
200
231
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
232
|
+
if (deductionUnified) {
|
|
233
|
+
const suppositions = axiomLemmaTheoremConjecture.getSuppositions(),
|
|
234
|
+
suppositionsUnified = this.unifySuppositions(suppositions, substitutions, generalContext, specificContext);
|
|
235
|
+
|
|
236
|
+
axiomLemmaTheoremConjectureUnified = suppositionsUnified; ///
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (axiomLemmaTheoremConjectureUnified) {
|
|
240
|
+
context.debug(`...unified the '${axiomLemmaTheoremConjectureString}' axiom, lemma, theorem or conjecture with the '${axiomString}' axiom.`);
|
|
204
241
|
}
|
|
205
242
|
|
|
206
|
-
return
|
|
243
|
+
return axiomLemmaTheoremConjectureUnified;
|
|
207
244
|
}
|
|
208
245
|
|
|
209
246
|
static name = "Axiom";
|
package/src/dom/deduction.js
CHANGED
|
@@ -61,6 +61,28 @@ export default domAssigned(class Deduction {
|
|
|
61
61
|
return statementUnified;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
unifyDeduction(deduction, substitutions, generalContext, specificContext) {
|
|
65
|
+
let deductionUnified;
|
|
66
|
+
|
|
67
|
+
const context = specificContext, ///
|
|
68
|
+
specificDeduction = deduction, ///
|
|
69
|
+
generalDeductionString = this.string, ///
|
|
70
|
+
specificDeductionString = specificDeduction.getString();
|
|
71
|
+
|
|
72
|
+
context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction...`);
|
|
73
|
+
|
|
74
|
+
const statement = specificDeduction.getStatement(),
|
|
75
|
+
statementUnified = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
76
|
+
|
|
77
|
+
deductionUnified = statementUnified; ///
|
|
78
|
+
|
|
79
|
+
if (deductionUnified) {
|
|
80
|
+
context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction.`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return deductionUnified;
|
|
84
|
+
}
|
|
85
|
+
|
|
64
86
|
toJSON() {
|
|
65
87
|
const statementJSON = statementToStatementJSON(this.statement),
|
|
66
88
|
statement = statementJSON, ///
|
package/src/dom/metavariable.js
CHANGED
package/src/dom/rule.js
CHANGED
|
@@ -119,7 +119,7 @@ export default domAssigned(class Rule {
|
|
|
119
119
|
if (premiseUnifiedIndependently) {
|
|
120
120
|
stepsOrSubproofsUnifiedWithPremise = true;
|
|
121
121
|
} else {
|
|
122
|
-
const
|
|
122
|
+
const stepOrSubproof = extract(stepsOrSubproofs, (stepOrSubproof) => {
|
|
123
123
|
const stepOrSubproofUnified = premise.unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext);
|
|
124
124
|
|
|
125
125
|
if (stepOrSubproofUnified) {
|
|
@@ -127,7 +127,7 @@ export default domAssigned(class Rule {
|
|
|
127
127
|
}
|
|
128
128
|
}) || null;
|
|
129
129
|
|
|
130
|
-
if (
|
|
130
|
+
if (stepOrSubproof !== null) {
|
|
131
131
|
stepsOrSubproofsUnifiedWithPremise = true;
|
|
132
132
|
}
|
|
133
133
|
}
|
package/src/dom/step.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
import unifyMixins from "../mixins/step/unify";
|
|
5
|
+
import LocalContext from "../context/local";
|
|
5
6
|
import Substitutions from "../substitutions";
|
|
6
7
|
|
|
7
8
|
import { domAssigned } from "../dom";
|
|
@@ -75,7 +76,7 @@ export default domAssigned(class Step {
|
|
|
75
76
|
verify(substitutions, assignments, context) {
|
|
76
77
|
let verified = false;
|
|
77
78
|
|
|
78
|
-
const stepString = this.string;
|
|
79
|
+
const stepString = this.string; ///
|
|
79
80
|
|
|
80
81
|
context.trace(`Verifying the '${stepString}' step...`);
|
|
81
82
|
|
|
@@ -107,13 +108,15 @@ export default domAssigned(class Step {
|
|
|
107
108
|
unifyStatement(statement, context) {
|
|
108
109
|
let statementUnified;
|
|
109
110
|
|
|
110
|
-
const
|
|
111
|
+
const substitutions = Substitutions.fromNothing(),
|
|
111
112
|
generalContext = context, ///
|
|
112
|
-
|
|
113
|
+
specificContext = context; ///
|
|
113
114
|
|
|
114
115
|
statementUnified = statement.unifyStatement(this.statement, substitutions, generalContext, specificContext);
|
|
115
116
|
|
|
116
117
|
if (statementUnified) {
|
|
118
|
+
substitutions.removeTrivialSubstitutions();
|
|
119
|
+
|
|
117
120
|
const equivalences = context.getEquivalences(),
|
|
118
121
|
substitutionsUnified = equivalences.unifySubstitutions(substitutions);
|
|
119
122
|
|
|
@@ -123,6 +126,37 @@ export default domAssigned(class Step {
|
|
|
123
126
|
return statementUnified;
|
|
124
127
|
}
|
|
125
128
|
|
|
129
|
+
unifySatisfiesAssertion(satisfiesAssertion, context) {
|
|
130
|
+
let unifySatisfiesAssertion = false;
|
|
131
|
+
|
|
132
|
+
const reference = satisfiesAssertion.getReference(),
|
|
133
|
+
axiom = context.findAxiomByReference(reference);
|
|
134
|
+
|
|
135
|
+
if (axiom !== null) {
|
|
136
|
+
const axiomUnconditional = axiom.isUnconditional();
|
|
137
|
+
|
|
138
|
+
if (axiomUnconditional) {
|
|
139
|
+
const step = this, ///
|
|
140
|
+
fileContext = axiom.getFileContext(),
|
|
141
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
142
|
+
substitutions = Substitutions.fromNothing(),
|
|
143
|
+
generalContext = localContext, ///
|
|
144
|
+
specificContext = context, ///
|
|
145
|
+
statementUnified = axiom.unifyStep(step, substitutions, generalContext, specificContext);
|
|
146
|
+
|
|
147
|
+
if (statementUnified) {
|
|
148
|
+
const substitutionsMatch = satisfiesAssertion.matchSubstitutions(substitutions, context);
|
|
149
|
+
|
|
150
|
+
if (substitutionsMatch) {
|
|
151
|
+
unifySatisfiesAssertion = true;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return unifySatisfiesAssertion;
|
|
158
|
+
}
|
|
159
|
+
|
|
126
160
|
static name = "Step";
|
|
127
161
|
|
|
128
162
|
static fromStatement(statement, context) {
|
package/src/dom/subproof.js
CHANGED
|
@@ -54,32 +54,10 @@ export default domAssigned(class Subproof {
|
|
|
54
54
|
return sStep;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
unifyStatement(statement, context) {
|
|
58
|
-
let statementUnified;
|
|
59
|
-
|
|
60
|
-
const specificContext = context, ///
|
|
61
|
-
generalContext = context, ///
|
|
62
|
-
substitutions = Substitutions.fromNothing(),
|
|
63
|
-
subproof = this;
|
|
64
|
-
|
|
65
|
-
const subproofUnified = statement.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
66
|
-
|
|
67
|
-
statementUnified = subproofUnified; ///
|
|
68
|
-
|
|
69
|
-
if (statementUnified) {
|
|
70
|
-
const equivalences = context.getEquivalences(),
|
|
71
|
-
substitutionsUnified = equivalences.unifySubstitutions(substitutions);
|
|
72
|
-
|
|
73
|
-
statementUnified = substitutionsUnified; ///
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return statementUnified;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
57
|
unify(substitutions, context) {
|
|
80
58
|
let unified;
|
|
81
59
|
|
|
82
|
-
unified = true;
|
|
60
|
+
unified = true; ///
|
|
83
61
|
|
|
84
62
|
return unified;
|
|
85
63
|
}
|
|
@@ -110,6 +88,60 @@ export default domAssigned(class Subproof {
|
|
|
110
88
|
return subproofVerified;
|
|
111
89
|
}
|
|
112
90
|
|
|
91
|
+
unifyStatement(statement, context) {
|
|
92
|
+
let statementUnified = false;
|
|
93
|
+
|
|
94
|
+
const subproof = this,
|
|
95
|
+
substitutions = Substitutions.fromNothing(),
|
|
96
|
+
generalContext = context, ///
|
|
97
|
+
specificContext = context, ///
|
|
98
|
+
subproofUnified = statement.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
99
|
+
|
|
100
|
+
if (subproofUnified) {
|
|
101
|
+
if (statementUnified) {
|
|
102
|
+
const equivalences = context.getEquivalences(),
|
|
103
|
+
substitutionsUnified = equivalences.unifySubstitutions(substitutions);
|
|
104
|
+
|
|
105
|
+
if (substitutionsUnified) {
|
|
106
|
+
statementUnified = true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return statementUnified;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
unifySatisfiesAssertion(satisfiesAssertion, context) {
|
|
115
|
+
let unifySatisfiesAssertion = false;
|
|
116
|
+
|
|
117
|
+
const reference = satisfiesAssertion.getReference(),
|
|
118
|
+
axiom = context.findAxiomByReference(reference);
|
|
119
|
+
|
|
120
|
+
if (axiom !== null) {
|
|
121
|
+
const axiomUnconditional = axiom.isUnconditional();
|
|
122
|
+
|
|
123
|
+
if (!axiomUnconditional) {
|
|
124
|
+
const subproof = this,
|
|
125
|
+
fileContext = axiom.getFileContext(),
|
|
126
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
127
|
+
substitutions = Substitutions.fromNothing(),
|
|
128
|
+
generalContext = localContext, ///
|
|
129
|
+
specificContext = context, ///
|
|
130
|
+
statementUnified = axiom.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
131
|
+
|
|
132
|
+
if (statementUnified) {
|
|
133
|
+
const substitutionsMatch = satisfiesAssertion.matchSubstitutions(substitutions, context);
|
|
134
|
+
|
|
135
|
+
if (substitutionsMatch) {
|
|
136
|
+
unifySatisfiesAssertion = true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return unifySatisfiesAssertion;
|
|
143
|
+
}
|
|
144
|
+
|
|
113
145
|
static name = "Subproof";
|
|
114
146
|
|
|
115
147
|
static fromStepOrSubproofNode(sStepOrSubproofNode, fileContext) {
|
|
@@ -24,6 +24,14 @@ export default domAssigned(class TermSubstitution extends Substitution {
|
|
|
24
24
|
return this.variable;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
isTrivial() {
|
|
28
|
+
const termString = this.term.getString(),
|
|
29
|
+
variableString = this.variable.getString(),
|
|
30
|
+
trivial = (termString === variableString);
|
|
31
|
+
|
|
32
|
+
return trivial;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
isTermEqualTo(term, context) {
|
|
28
36
|
term = stripBracketsFromTerm(term); ///
|
|
29
37
|
|
package/src/dom/substitution.js
CHANGED
|
@@ -74,6 +74,12 @@ export default class Substitution {
|
|
|
74
74
|
return complex;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
isTrivial() {
|
|
78
|
+
const trivial = false;
|
|
79
|
+
|
|
80
|
+
return trivial;
|
|
81
|
+
}
|
|
82
|
+
|
|
77
83
|
isEqualTo(substitution) {
|
|
78
84
|
const substitutionString = substitution.getString(),
|
|
79
85
|
equalTo = (substitutionString === this.string);
|
package/src/dom/supposition.js
CHANGED
|
@@ -72,6 +72,28 @@ export default domAssigned(class Supposition {
|
|
|
72
72
|
return verified;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
unifySupposition(supposition, substitutions, generalContext, specificContext) {
|
|
76
|
+
let suppositionUnified;
|
|
77
|
+
|
|
78
|
+
const context = specificContext, ///
|
|
79
|
+
specificSupposition = supposition, ///
|
|
80
|
+
generalSuppositionString = this.string, ///
|
|
81
|
+
specificSuppositionString = specificSupposition.getString();
|
|
82
|
+
|
|
83
|
+
context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition...`);
|
|
84
|
+
|
|
85
|
+
const statement = specificSupposition.getStatement(),
|
|
86
|
+
statementUnified = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
87
|
+
|
|
88
|
+
suppositionUnified = statementUnified; ///
|
|
89
|
+
|
|
90
|
+
if (suppositionUnified) {
|
|
91
|
+
context.debug(`...unified the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition.`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return suppositionUnified;
|
|
95
|
+
}
|
|
96
|
+
|
|
75
97
|
unifyIndependently(substitutions, context) {
|
|
76
98
|
let unifiedIndependently;
|
|
77
99
|
|
package/src/dom/term.js
CHANGED
|
@@ -58,6 +58,19 @@ export default class TopLevelAssertion {
|
|
|
58
58
|
|
|
59
59
|
getStatement() { return this.deduction.getStatement(); }
|
|
60
60
|
|
|
61
|
+
getSupposition(index) {
|
|
62
|
+
const supposition = this.suppositions[index] || null;
|
|
63
|
+
|
|
64
|
+
return supposition;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
isUnconditional() {
|
|
68
|
+
const suppositionsLength = this.suppositions.length,
|
|
69
|
+
unconditional = (suppositionsLength === 0);
|
|
70
|
+
|
|
71
|
+
return unconditional;
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
matchMetavariableName(metavariableName) {
|
|
62
75
|
const metavariableNameMatches = this.labels.some((label) => {
|
|
63
76
|
const metavariableNameMatches = label.matchMetavariableName(metavariableName);
|
|
@@ -179,7 +192,7 @@ export default class TopLevelAssertion {
|
|
|
179
192
|
}
|
|
180
193
|
|
|
181
194
|
unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext) {
|
|
182
|
-
let stepsOrSubproofsUnifiedWithSupposition
|
|
195
|
+
let stepsOrSubproofsUnifiedWithSupposition = false;
|
|
183
196
|
|
|
184
197
|
const context = specificContext, ///
|
|
185
198
|
suppositionUnifiedIndependently = supposition.unifyIndependently(substitutions, context);
|
|
@@ -187,15 +200,15 @@ export default class TopLevelAssertion {
|
|
|
187
200
|
if (suppositionUnifiedIndependently) {
|
|
188
201
|
stepsOrSubproofsUnifiedWithSupposition = true;
|
|
189
202
|
} else {
|
|
190
|
-
const
|
|
191
|
-
const
|
|
203
|
+
const stepOrSubproof = extract(stepsOrSubproofs, (stepOrSubproof) => {
|
|
204
|
+
const stepOrSubproofUnified = supposition.unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext);
|
|
192
205
|
|
|
193
|
-
if (
|
|
206
|
+
if (stepOrSubproofUnified) {
|
|
194
207
|
return true;
|
|
195
208
|
}
|
|
196
209
|
}) || null;
|
|
197
210
|
|
|
198
|
-
if (
|
|
211
|
+
if (stepOrSubproof !== null) {
|
|
199
212
|
stepsOrSubproofsUnifiedWithSupposition = true;
|
|
200
213
|
}
|
|
201
214
|
}
|