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/subproof.js
CHANGED
|
@@ -22,28 +22,28 @@ export default define(class Subproof extends Element {
|
|
|
22
22
|
return this.subDerivation;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
getLastProofAssertion() { return this.subDerivation.getLastProofAssertion(); }
|
|
26
26
|
|
|
27
27
|
getStatements() {
|
|
28
|
-
const
|
|
28
|
+
const lastProofAssertion = this.getLastProofAssertion(),
|
|
29
29
|
suppositionStatements = this.suppositions.map((supposition) => {
|
|
30
30
|
const suppositionStatement = supposition.getStatement();
|
|
31
31
|
|
|
32
32
|
return suppositionStatement;
|
|
33
33
|
}),
|
|
34
|
-
|
|
34
|
+
lastProofAssertionStatement = lastProofAssertion.getStatement(),
|
|
35
35
|
statements = [
|
|
36
36
|
...suppositionStatements,
|
|
37
|
-
|
|
37
|
+
lastProofAssertionStatement
|
|
38
38
|
];
|
|
39
39
|
|
|
40
40
|
return statements;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
const
|
|
43
|
+
isProofAssertion() {
|
|
44
|
+
const proofAssertion = false;
|
|
45
45
|
|
|
46
|
-
return
|
|
46
|
+
return proofAssertion;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
verify(substitutions, assignments, context) {
|
|
@@ -1,25 +1,19 @@
|
|
|
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
8
|
import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
|
|
10
9
|
|
|
11
|
-
export default define(class Supposition extends
|
|
10
|
+
export default define(class Supposition extends ProofAssertion {
|
|
12
11
|
constructor(context, string, node, statement, procedureCall) {
|
|
13
12
|
super(context, string, node);
|
|
14
13
|
|
|
15
|
-
this.statement = statement;
|
|
16
14
|
this.procedureCall = procedureCall;
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
getStatement() {
|
|
20
|
-
return this.statement;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
17
|
getProcedureCall() {
|
|
24
18
|
return this.procedureCall;
|
|
25
19
|
}
|
|
@@ -36,23 +30,23 @@ export default define(class Supposition extends Element {
|
|
|
36
30
|
|
|
37
31
|
context.trace(`Verifying the '${suppositionString}' supposition...`, node);
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
const statement = this.getStatement();
|
|
34
|
+
|
|
35
|
+
if ((statement === null) && (this.procedureCall === null)) {
|
|
40
36
|
context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, node);
|
|
41
37
|
} else {
|
|
42
|
-
if (
|
|
38
|
+
if (statement !== null) {
|
|
43
39
|
const stated = true,
|
|
44
40
|
assignments = [],
|
|
45
|
-
statementValidates =
|
|
41
|
+
statementValidates = statement.validate(assignments, stated, context);
|
|
46
42
|
|
|
47
43
|
if (statementValidates) {
|
|
48
44
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
49
45
|
|
|
50
46
|
if (assignmentsAssigned) {
|
|
51
|
-
const
|
|
52
|
-
step = Step.fromStatement(this.statement, context),
|
|
53
|
-
stepOrSubproof = step; ///
|
|
47
|
+
const subproofOrProofAssertion = this; ///
|
|
54
48
|
|
|
55
|
-
context.
|
|
49
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
56
50
|
|
|
57
51
|
verifies = true;
|
|
58
52
|
}
|
|
@@ -95,8 +89,10 @@ export default define(class Supposition extends Element {
|
|
|
95
89
|
|
|
96
90
|
context = specificContext; ///
|
|
97
91
|
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
const statement = this.getStatement();
|
|
93
|
+
|
|
94
|
+
if (statement !== null) {
|
|
95
|
+
const statementUnifiesIndependently = statement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
100
96
|
|
|
101
97
|
if (statementUnifiesIndependently) {
|
|
102
98
|
unifiesIndependently = true;
|
|
@@ -118,113 +114,118 @@ export default define(class Supposition extends Element {
|
|
|
118
114
|
return unifiesIndependently;
|
|
119
115
|
}
|
|
120
116
|
|
|
121
|
-
|
|
122
|
-
let
|
|
117
|
+
unifySubproofOrProosAssertion(subproofOrProofAssertion, substitutions, context) {
|
|
118
|
+
let subproofOrProofAssertionUnifies = false;
|
|
123
119
|
|
|
124
|
-
const
|
|
125
|
-
subproof =
|
|
120
|
+
const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
|
|
121
|
+
subproof = subproofOrProofAssertionProofAssertion ?
|
|
126
122
|
null :
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
subproofOrProofAssertion,
|
|
124
|
+
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
125
|
+
subproofOrProofAssertion :
|
|
126
|
+
null;
|
|
131
127
|
|
|
132
128
|
substitutions.snapshot();
|
|
133
129
|
|
|
134
130
|
if (subproof !== null) {
|
|
135
131
|
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
136
132
|
|
|
137
|
-
|
|
133
|
+
if (subproofUnifies) {
|
|
134
|
+
subproofOrProofAssertionUnifies = true;
|
|
135
|
+
}
|
|
138
136
|
}
|
|
139
137
|
|
|
140
|
-
if (
|
|
141
|
-
const
|
|
138
|
+
if (proofAssertion !== null) {
|
|
139
|
+
const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, substitutions, context);
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
if (proofAssertionUnifies) {
|
|
142
|
+
subproofOrProofAssertionUnifies = true;
|
|
143
|
+
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
if (
|
|
146
|
+
if (subproofOrProofAssertionUnifies) {
|
|
147
147
|
substitutions.resolve(context);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
subproofOrProofAssertionUnifies ?
|
|
151
151
|
substitutions.continue() :
|
|
152
152
|
substitutions.rollback(context);
|
|
153
153
|
|
|
154
|
-
return
|
|
154
|
+
return subproofOrProofAssertionUnifies;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
|
|
158
|
-
let
|
|
157
|
+
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
158
|
+
let stepUnifies = false;
|
|
159
159
|
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
suppositionStatementString = suppositionStatement.getString();
|
|
160
|
+
const node = this.getNode(),
|
|
161
|
+
suppositionString = this.getString(),
|
|
162
|
+
proofAssertionString = proofAssertion.getString();
|
|
164
163
|
|
|
165
|
-
context.trace(`Unifying the '${
|
|
164
|
+
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`, node);
|
|
166
165
|
|
|
167
166
|
const specificContext = context; ///
|
|
168
167
|
|
|
169
168
|
context = this.getContext();
|
|
170
169
|
|
|
171
|
-
const generalContext = context;
|
|
170
|
+
const generalContext = context; ///
|
|
172
171
|
|
|
173
172
|
context = specificContext; ///
|
|
174
173
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
assertionNode = node, ///
|
|
178
|
-
assertion = context.findAssertionByAssertionNode(assertionNode);
|
|
179
|
-
|
|
180
|
-
if (assertion !== null) {}
|
|
174
|
+
const statement = proofAssertion.getStatement(),
|
|
175
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
181
176
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
177
|
+
if (statementUnifies) {
|
|
178
|
+
stepUnifies = true;
|
|
185
179
|
}
|
|
186
180
|
|
|
187
|
-
if (
|
|
188
|
-
context.debug(`...unified the '${
|
|
181
|
+
if (stepUnifies) {
|
|
182
|
+
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`, node);
|
|
189
183
|
}
|
|
190
184
|
|
|
191
|
-
return
|
|
185
|
+
return stepUnifies;
|
|
192
186
|
}
|
|
193
187
|
|
|
194
|
-
|
|
195
|
-
let
|
|
188
|
+
unifySubproof(subproof, substitutions, context) {
|
|
189
|
+
let subproofUnifies = false;
|
|
196
190
|
|
|
197
|
-
|
|
191
|
+
const node = this.getNode(),
|
|
192
|
+
subproofString = subproof.getString(),
|
|
193
|
+
suppositionString = this.getString();
|
|
198
194
|
|
|
199
|
-
|
|
200
|
-
statementUnifies = this.unifyStatement(statement, substitutions, context);
|
|
195
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${suppositionString}' supposition...`, node);
|
|
201
196
|
|
|
202
|
-
|
|
197
|
+
const specificContext = context; ///
|
|
203
198
|
|
|
204
|
-
|
|
205
|
-
}
|
|
199
|
+
context = this.getContext();
|
|
206
200
|
|
|
207
|
-
|
|
208
|
-
let statementUnifies;
|
|
201
|
+
const generalContext = context; ///
|
|
209
202
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
203
|
+
context = specificContext; ///
|
|
204
|
+
|
|
205
|
+
const statement = this.getStatement();
|
|
213
206
|
|
|
214
|
-
|
|
207
|
+
if (statement !== null) {
|
|
208
|
+
const statementNode = statement.getNode(),
|
|
209
|
+
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
215
210
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
211
|
+
if (subproofAssertionNode !== null) {
|
|
212
|
+
const context = generalContext, ///
|
|
213
|
+
assertionNode = subproofAssertionNode, ///
|
|
214
|
+
assertion = context.findAssertionByAssertionNode(assertionNode)
|
|
219
215
|
|
|
220
|
-
|
|
216
|
+
if (assertion !== null) {
|
|
217
|
+
const subproofAssertion = assertion; ///
|
|
218
|
+
|
|
219
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
if (
|
|
224
|
-
context.debug(`...unified the '${
|
|
224
|
+
if (subproofUnifies) {
|
|
225
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${suppositionString}' supposition.`, node);
|
|
225
226
|
}
|
|
226
227
|
|
|
227
|
-
return
|
|
228
|
+
return subproofUnifies;
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
unifySupposition(supposition, substitutions, generalContext, specificContext) {
|
package/src/metaTypes.js
CHANGED
|
@@ -8,6 +8,19 @@ let frameMetaType = null,
|
|
|
8
8
|
referenceMetaType = null,
|
|
9
9
|
statementMetaType = null;
|
|
10
10
|
|
|
11
|
+
export function getMetaTypes() {
|
|
12
|
+
const frameMetaType = frameMetaTypeFromNothing(),
|
|
13
|
+
referenceMetaType = referenceMetaTypeFromNothing(),
|
|
14
|
+
statementMetaType = statementMetaTypeFromNothing(),
|
|
15
|
+
metaTypes = [
|
|
16
|
+
frameMetaType,
|
|
17
|
+
referenceMetaType,
|
|
18
|
+
statementMetaType
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
return metaTypes;
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
export function frameMetaTypeFromNothing() {
|
|
12
25
|
if (frameMetaType === null) {
|
|
13
26
|
const { MetaType } = elements,
|
|
@@ -19,24 +32,24 @@ export function frameMetaTypeFromNothing() {
|
|
|
19
32
|
return frameMetaType;
|
|
20
33
|
}
|
|
21
34
|
|
|
22
|
-
export function
|
|
23
|
-
if (
|
|
35
|
+
export function statementMetaTypeFromNothing() {
|
|
36
|
+
if (statementMetaType === null) {
|
|
24
37
|
const { MetaType } = elements,
|
|
25
|
-
name =
|
|
38
|
+
name = STATEMENT_META_TYPE_NAME; ///
|
|
26
39
|
|
|
27
|
-
|
|
40
|
+
statementMetaType = MetaType.fromName(name);
|
|
28
41
|
}
|
|
29
42
|
|
|
30
|
-
return
|
|
43
|
+
return statementMetaType;
|
|
31
44
|
}
|
|
32
45
|
|
|
33
|
-
export function
|
|
34
|
-
if (
|
|
46
|
+
export function referenceMetaTypeFromNothing() {
|
|
47
|
+
if (referenceMetaType === null) {
|
|
35
48
|
const { MetaType } = elements,
|
|
36
|
-
name =
|
|
49
|
+
name = REFERENCE_META_TYPE_NAME; ///
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
referenceMetaType = MetaType.fromName(name);
|
|
39
52
|
}
|
|
40
53
|
|
|
41
|
-
return
|
|
54
|
+
return referenceMetaType;
|
|
42
55
|
}
|
|
@@ -5,13 +5,6 @@ import NonTerminalNode from "../nonTerminalNode";
|
|
|
5
5
|
import { STEP_RULE_NAME, SUBPROOF_RULE_NAME } from "../ruleNames";
|
|
6
6
|
|
|
7
7
|
export default class SubDerivationNode extends NonTerminalNode {
|
|
8
|
-
getLastStepNode() {
|
|
9
|
-
const ruleName = STEP_RULE_NAME,
|
|
10
|
-
lastStepNode = this.getLastNodeByRuleName(ruleName);
|
|
11
|
-
|
|
12
|
-
return lastStepNode;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
8
|
getStepOrSubproofNodes() {
|
|
16
9
|
const ruleNames = [
|
|
17
10
|
STEP_RULE_NAME,
|
package/src/node/subproof.js
CHANGED
|
@@ -17,13 +17,6 @@ export default class SubproofNode extends NonTerminalNode {
|
|
|
17
17
|
return subproofNode;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
getLastStepNode() {
|
|
21
|
-
const subDerivationNode = this.getSubDerivationNode(),
|
|
22
|
-
lastStepNode = subDerivationNode.getLastStepNode();
|
|
23
|
-
|
|
24
|
-
return lastStepNode;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
getSuppositionNodes() {
|
|
28
21
|
const ruleName = SUPPOSITION_RULE_NAME,
|
|
29
22
|
suppositionNodes = this.getNodesByRuleName(ruleName);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { termFromTermNode, statementFromStatementNode } from "../utilities/element";
|
|
5
4
|
import { BRACKETED_TERM_DEPTH, BRACKETED_STATEMENT_DEPTH } from "../constants";
|
|
6
5
|
import { bracketedConstructorFromNothing, bracketedCombinatorFromNothing } from "../utilities/instance";
|
|
7
6
|
|
|
@@ -10,10 +9,9 @@ export function stripBracketsFromTerm(term, context) {
|
|
|
10
9
|
bracketedTermChildNode = bracketedTermChildNodeFromTermNode(termNode);
|
|
11
10
|
|
|
12
11
|
if (bracketedTermChildNode !== null) {
|
|
13
|
-
const
|
|
14
|
-
termNode = bracketedTermChildNode; ///
|
|
12
|
+
const termNode = bracketedTermChildNode; ///
|
|
15
13
|
|
|
16
|
-
term =
|
|
14
|
+
term = termFromTermNode(termNode, context);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
return term;
|
|
@@ -34,10 +32,9 @@ export function stripBracketsFromStatement(statement, context) {
|
|
|
34
32
|
bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
|
|
35
33
|
|
|
36
34
|
if (bracketedStatementChildNode !== null) {
|
|
37
|
-
const
|
|
38
|
-
statementNode = bracketedStatementChildNode; ///
|
|
35
|
+
const statementNode = bracketedStatementChildNode; ///
|
|
39
36
|
|
|
40
|
-
statement =
|
|
37
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
return statement;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import nominalContext from "../context/nominal";
|
|
4
4
|
|
|
5
|
+
import { getMetaTypes } from "../metaTypes";
|
|
5
6
|
import { BASE_TYPE_SYMBOL } from "../constants";
|
|
6
7
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
7
8
|
import { instantiateCombinator, instantiateConstructor } from "../process/instantiate";
|
|
@@ -21,9 +22,7 @@ export function bracketedCombinatorFromNothing() {
|
|
|
21
22
|
const combinatorNode = instantiateCombinator(string, context),
|
|
22
23
|
bracketedCombinatorNode = combinatorNode; ///
|
|
23
24
|
|
|
24
|
-
context =
|
|
25
|
-
nodeAsString: () => string
|
|
26
|
-
};
|
|
25
|
+
context = contextFromString(string);
|
|
27
26
|
|
|
28
27
|
bracketedCombinator = combinatorFromCombinatorNode(bracketedCombinatorNode, context);
|
|
29
28
|
}
|
|
@@ -42,12 +41,31 @@ export function bracketedConstructorFromNothing() {
|
|
|
42
41
|
const constructorNode = instantiateConstructor(string, context),
|
|
43
42
|
bracketedConstructorNode = constructorNode; ///
|
|
44
43
|
|
|
45
|
-
context =
|
|
46
|
-
nodeAsString: () => string
|
|
47
|
-
};
|
|
44
|
+
context = contextFromString(string);
|
|
48
45
|
|
|
49
46
|
bracketedConstructor = constructorFromConstructorNode(bracketedConstructorNode, context);
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
return bracketedConstructor;
|
|
53
50
|
}
|
|
51
|
+
|
|
52
|
+
function contextFromString(string) {
|
|
53
|
+
const context = {
|
|
54
|
+
nodeAsString: () => string,
|
|
55
|
+
getMetaTypes: () => getMetaTypes(),
|
|
56
|
+
findMetaTypeByMetaTypeName(metaTypeName) {
|
|
57
|
+
const metaTypes = this.getMetaTypes(),
|
|
58
|
+
metaType = metaTypes.find((metaType) => {
|
|
59
|
+
const metaTypeComparesToMetaTypeName = metaType.compareMetaTypeName(metaTypeName);
|
|
60
|
+
|
|
61
|
+
if (metaTypeComparesToMetaTypeName) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
}) || null;
|
|
65
|
+
|
|
66
|
+
return metaType;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return context;
|
|
71
|
+
}
|
package/src/utilities/string.js
CHANGED
|
@@ -150,17 +150,17 @@ export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conc
|
|
|
150
150
|
conclusionString = conclusion.getString(),
|
|
151
151
|
labelsString = labelsStringFromLabels(labels),
|
|
152
152
|
ruleString = (premisesString !== null) ?
|
|
153
|
-
`${labelsString} :: [${premisesString}]
|
|
153
|
+
`${labelsString} :: [${premisesString}]...${conclusionString}` :
|
|
154
154
|
`${labelsString} :: ${conclusionString}`;
|
|
155
155
|
|
|
156
156
|
return ruleString;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
export function subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation) {
|
|
160
|
-
const
|
|
161
|
-
lastStepString = lastStep.getString(),
|
|
160
|
+
const lastProofAssertion = subDerivation.getLastProofAssertion(),
|
|
162
161
|
suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
163
|
-
|
|
162
|
+
lastProofAssertionString = lastProofAssertion.getString(),
|
|
163
|
+
subproofString = `[${suppositionsString}]...${lastProofAssertionString}`;
|
|
164
164
|
|
|
165
165
|
return subproofString;
|
|
166
166
|
}
|
|
@@ -205,7 +205,7 @@ export function metaLemmaMetatheoremStringFromLabelSuppositionsAndDeduction(labe
|
|
|
205
205
|
deductionString = deduction.getString(),
|
|
206
206
|
labelString = label.getString(),
|
|
207
207
|
metaLemmaMetatheoremString = (suppositionsString !== null) ?
|
|
208
|
-
`${labelString} :: [${suppositionsString}]
|
|
208
|
+
`${labelString} :: [${suppositionsString}]...${deductionString}` :
|
|
209
209
|
`${labelString} :: ${deductionString}`;
|
|
210
210
|
|
|
211
211
|
return metaLemmaMetatheoremString;
|
|
@@ -220,11 +220,11 @@ export function axiomLemmaTheoremConjectureStringFromLabelsSuppositionsAndDeduct
|
|
|
220
220
|
|
|
221
221
|
if (labelsString !== null) {
|
|
222
222
|
axiomLemmaTheoremConjectureString = (suppositionsString !== null) ?
|
|
223
|
-
`${labelsString} :: [${suppositionsString}]
|
|
223
|
+
`${labelsString} :: [${suppositionsString}]...${deductionString}` :
|
|
224
224
|
`${labelsString} :: ${deductionString}`;
|
|
225
225
|
} else {
|
|
226
226
|
axiomLemmaTheoremConjectureString = (suppositionsString !== null) ?
|
|
227
|
-
`[${suppositionsString}]
|
|
227
|
+
`[${suppositionsString}]...${deductionString}` :
|
|
228
228
|
deductionString;
|
|
229
229
|
}
|
|
230
230
|
|
|
@@ -24,10 +24,10 @@ function unifyStatementWithRule(statement, reference, satisfiesAssertion, substi
|
|
|
24
24
|
|
|
25
25
|
context.trace(`Unifying the '${statementString}' statement with the '${ruleString}' rule...`);
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
28
|
+
statementAndSubproofOrProofAssertionsUnify = rule.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
|
|
29
29
|
|
|
30
|
-
if (
|
|
30
|
+
if (statementAndSubproofOrProofAssertionsUnify) {
|
|
31
31
|
statementUnifiesWithRule = true;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -44,14 +44,14 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
|
|
|
44
44
|
let statementUnifiesWithReference = false;
|
|
45
45
|
|
|
46
46
|
if (reference !== null) {
|
|
47
|
-
const
|
|
47
|
+
const statementString = statement.getString(),
|
|
48
|
+
referenceString = reference.getString();
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
const statementString = statement.getString(),
|
|
51
|
-
referenceString = reference.getString();
|
|
50
|
+
context.trace(`Unifying the '${statementString}' statement with the '${referenceString}' reference...`);
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
const metavariableValidates = reference.validateMetavariable(context);
|
|
54
53
|
|
|
54
|
+
if (metavariableValidates) {
|
|
55
55
|
const { StatementSubstitution } = elements,
|
|
56
56
|
metavariable = reference.getMetavariable(),
|
|
57
57
|
statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
|
|
@@ -60,10 +60,10 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
|
|
|
60
60
|
substitutions.addSubstitution(substitution, context);
|
|
61
61
|
|
|
62
62
|
statementUnifiesWithReference = true;
|
|
63
|
+
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
65
|
+
if (statementUnifiesWithReference) {
|
|
66
|
+
context.debug(`...unified the '${statementString}' statement with the '${referenceString}' reference.`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -86,9 +86,9 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
|
|
|
86
86
|
satisfiesAssertion.verifySignature(assignments, stated, context);
|
|
87
87
|
|
|
88
88
|
if (reference === null) {
|
|
89
|
-
const
|
|
89
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
90
90
|
|
|
91
|
-
statementUnifiesAsSatisfiesAssertion = backwardsSome(
|
|
91
|
+
statementUnifiesAsSatisfiesAssertion = backwardsSome(subproofOrProofAssertions, (stepsOrSubproof) => {
|
|
92
92
|
const stepOrSubProofUnifiesWIthSatisfiesAssertion = stepsOrSubproof.unifyWithSatisfiesAssertion(satisfiesAssertion, context);
|
|
93
93
|
|
|
94
94
|
if (stepOrSubProofUnifiesWIthSatisfiesAssertion) {
|
|
@@ -149,13 +149,13 @@ function unifyStatementWithAxiomLemmaTheoremOrConjecture(statement, reference, s
|
|
|
149
149
|
|
|
150
150
|
context.trace(`Unifying the '${statementString}' statement with the '${axiomLemmaTheoremOrConjectureString}' axiom, lemma, theorem or conjecture...`);
|
|
151
151
|
|
|
152
|
-
const
|
|
152
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
153
153
|
|
|
154
154
|
substitutions = Substitutions.fromNothing();
|
|
155
155
|
|
|
156
|
-
const
|
|
156
|
+
const statementAndSubproofOrProofAssertionsUnify = axiomLemmaTheoremOrConjecture.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, substitutions, context);
|
|
157
157
|
|
|
158
|
-
if (
|
|
158
|
+
if (statementAndSubproofOrProofAssertionsUnify) {
|
|
159
159
|
const { StatementSubstitution } = elements,
|
|
160
160
|
metavariable = reference.getMetavariable(),
|
|
161
161
|
statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
|
|
@@ -292,8 +292,8 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
|
|
|
292
292
|
|
|
293
293
|
context.trace(`Unifying the '${statementString}' statememnt with the '${satisfiesAssertionString}' satisfies assertion...`);
|
|
294
294
|
|
|
295
|
-
const
|
|
296
|
-
statementUnifies = satisfiesAssertion.
|
|
295
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
296
|
+
statementUnifies = satisfiesAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
|
|
297
297
|
|
|
298
298
|
if (statementUnifies) {
|
|
299
299
|
statementUnifiesWithSatisfiesAssertion = true;
|
|
@@ -307,23 +307,23 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
|
|
|
307
307
|
return statementUnifiesWithSatisfiesAssertion;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
function
|
|
310
|
+
function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion, substitutions, context) {
|
|
311
311
|
let statementEquatesWithStepOrSubproofs = false;
|
|
312
312
|
|
|
313
313
|
if (reference === null) {
|
|
314
314
|
const statementString = statement.getString();
|
|
315
315
|
|
|
316
|
-
context.trace(`Comparing the '${statementString}' statement with the
|
|
316
|
+
context.trace(`Comparing the '${statementString}' statement with the subproofs or proof asssertions...`);
|
|
317
317
|
|
|
318
|
-
const
|
|
319
|
-
statementUnifiesWithSteps = statement.
|
|
318
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
319
|
+
statementUnifiesWithSteps = statement.compareSubproofOrProofAssertions(subproofOrProofAssertions, context);
|
|
320
320
|
|
|
321
321
|
if (statementUnifiesWithSteps) {
|
|
322
322
|
statementEquatesWithStepOrSubproofs = true;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
if (statementEquatesWithStepOrSubproofs) {
|
|
326
|
-
context.debug(`...compared the '${statementString}' statement with the
|
|
326
|
+
context.debug(`...compared the '${statementString}' statement with the subproofs or proof asssertions.`);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
|
|
@@ -340,5 +340,5 @@ export const unifyStatements = [
|
|
|
340
340
|
unifyStatementAsTypeAssertion,
|
|
341
341
|
unifyStatementAsPropertyAssertion,
|
|
342
342
|
unifyStatementWithSatisfiesAssertion,
|
|
343
|
-
|
|
343
|
+
compareStatementWithSubproofOrProofAssertions
|
|
344
344
|
];
|