occam-verify-cli 0.0.1111 → 0.0.1114
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/combinator/bracketed.js +15 -65
- package/lib/combinator.js +4 -8
- package/lib/constructor/bracketed.js +24 -101
- package/lib/constructor.js +4 -8
- package/lib/context/file.js +41 -12
- package/lib/context/local.js +45 -25
- package/lib/context/release.js +2 -2
- package/lib/dom/assertion/contained.js +287 -0
- package/lib/dom/assertion/defined.js +266 -0
- package/lib/dom/assertion/subproof.js +210 -0
- package/lib/dom/assertion/type.js +240 -0
- package/lib/{axiom.js → dom/axiom.js} +18 -8
- package/lib/dom/conclusion.js +171 -0
- package/lib/{conjecture.js → dom/conjecture.js} +18 -8
- package/lib/dom/consequent.js +171 -0
- package/lib/dom/declaration/combinator.js +105 -0
- package/lib/dom/declaration/constructor.js +140 -0
- package/lib/dom/declaration/metavariable.js +154 -0
- package/lib/dom/declaration/type.js +140 -0
- package/lib/dom/declaration/variable.js +155 -0
- package/lib/{declaration.js → dom/declaration.js} +62 -18
- package/lib/dom/derivation.js +137 -0
- package/lib/dom/equality.js +260 -0
- package/lib/dom/error.js +85 -0
- package/lib/dom/frame.js +372 -0
- package/lib/dom/judgement.js +198 -0
- package/lib/dom/label.js +190 -0
- package/lib/{lemma.js → dom/lemma.js} +19 -9
- package/lib/{metaLemma.js → dom/metaLemma.js} +19 -9
- package/lib/dom/metaType.js +261 -0
- package/lib/dom/metatheorem.js +273 -0
- package/lib/dom/metavariable.js +463 -0
- package/lib/dom/premise.js +221 -0
- package/lib/dom/proof.js +154 -0
- package/lib/dom/proofStep.js +239 -0
- package/lib/dom/reference.js +218 -0
- package/lib/dom/rule.js +311 -0
- package/lib/dom/statement.js +379 -0
- package/lib/dom/subDerivation.js +137 -0
- package/lib/dom/subproof.js +211 -0
- package/lib/dom/supposition.js +221 -0
- package/lib/dom/term.js +354 -0
- package/lib/{theorem.js → dom/theorem.js} +18 -8
- package/lib/dom/topLevelAssertion.js +306 -0
- package/lib/dom/type.js +327 -0
- package/lib/dom/variable.js +328 -0
- package/lib/dom.js +27 -0
- package/lib/equivalences.js +307 -0
- package/lib/index.js +40 -35
- package/lib/mixins/proofStep/unify.js +86 -0
- package/lib/mixins/statement/verify.js +27 -2
- package/lib/mixins/term/verify.js +24 -4
- package/lib/substitution/frame.js +3 -3
- package/lib/substitution/statement.js +17 -16
- package/lib/substitution/term.js +10 -7
- package/lib/substitution.js +4 -31
- package/lib/substitutions.js +24 -56
- package/lib/unifier/equality.js +2 -3
- package/lib/unifier/label.js +3 -3
- package/lib/unifier/metaLevel.js +9 -8
- package/lib/unifier/metavariable.js +3 -3
- package/lib/unifier/statementWithCombinator.js +5 -5
- package/lib/unifier/termWithConstructor.js +3 -3
- package/lib/utilities/json.js +26 -40
- package/lib/utilities/string.js +6 -8
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/substitutions.js +7 -6
- package/lib/utilities/verification.js +22 -14
- package/lib/verifier/combinator.js +4 -4
- package/lib/verifier/constructor.js +3 -3
- package/lib/verifier/topLevel.js +15 -21
- package/package.json +1 -1
- package/src/combinator/bracketed.js +11 -4
- package/src/combinator.js +3 -10
- package/src/constructor/bracketed.js +17 -5
- package/src/constructor.js +3 -9
- package/src/context/file.js +42 -11
- package/src/context/local.js +26 -34
- package/src/context/release.js +1 -1
- package/src/{assertion → dom/assertion}/contained.js +11 -8
- package/src/{assertion → dom/assertion}/defined.js +14 -11
- package/src/{assertion → dom/assertion}/subproof.js +11 -62
- package/src/{assertion → dom/assertion}/type.js +11 -8
- package/src/{axiom.js → dom/axiom.js} +6 -9
- package/src/dom/conclusion.js +95 -0
- package/src/{conjecture.js → dom/conjecture.js} +5 -8
- package/src/dom/consequent.js +95 -0
- package/src/{declaration → dom/declaration}/combinator.js +8 -5
- package/src/{declaration → dom/declaration}/constructor.js +8 -4
- package/src/{declaration → dom/declaration}/metavariable.js +8 -5
- package/src/{declaration → dom/declaration}/type.js +8 -4
- package/src/{declaration → dom/declaration}/variable.js +9 -6
- package/src/{declaration.js → dom/declaration.js} +11 -16
- package/src/{derivation.js → dom/derivation.js} +9 -12
- package/src/{equality.js → dom/equality.js} +11 -14
- package/src/{error.js → dom/error.js} +6 -3
- package/src/{frame.js → dom/frame.js} +14 -23
- package/src/{judgement.js → dom/judgement.js} +8 -11
- package/src/{label.js → dom/label.js} +9 -16
- package/src/{lemma.js → dom/lemma.js} +5 -9
- package/src/{metaLemma.js → dom/metaLemma.js} +6 -9
- package/src/{metaType.js → dom/metaType.js} +7 -10
- package/src/{metatheorem.js → dom/metatheorem.js} +6 -10
- package/src/{metavariable.js → dom/metavariable.js} +79 -77
- package/src/dom/premise.js +173 -0
- package/src/{proof.js → dom/proof.js} +8 -11
- package/src/dom/proofStep.js +173 -0
- package/src/{reference.js → dom/reference.js} +48 -20
- package/src/{rule.js → dom/rule.js} +13 -17
- package/src/{statement.js → dom/statement.js} +142 -71
- package/src/{subDerivation.js → dom/subDerivation.js} +9 -12
- package/src/{subproof.js → dom/subproof.js} +14 -47
- package/src/dom/supposition.js +173 -0
- package/src/{term.js → dom/term.js} +24 -45
- package/src/{theorem.js → dom/theorem.js} +5 -8
- package/src/{topLevelAssertion.js → dom/topLevelAssertion.js} +12 -14
- package/src/{type.js → dom/type.js} +9 -12
- package/src/{variable.js → dom/variable.js} +20 -28
- package/src/dom.js +13 -0
- package/src/equivalences.js +278 -0
- package/src/index.js +39 -34
- package/src/mixins/proofStep/unify.js +115 -0
- package/src/mixins/statement/verify.js +33 -1
- package/src/mixins/term/verify.js +33 -3
- package/src/substitution/frame.js +2 -2
- package/src/substitution/statement.js +20 -18
- package/src/substitution/term.js +12 -5
- package/src/substitution.js +4 -29
- package/src/substitutions.js +35 -73
- package/src/unifier/equality.js +1 -2
- package/src/unifier/label.js +2 -2
- package/src/unifier/metaLevel.js +9 -7
- package/src/unifier/metavariable.js +2 -2
- package/src/unifier/statementWithCombinator.js +4 -4
- package/src/unifier/termWithConstructor.js +2 -2
- package/src/utilities/json.js +23 -42
- package/src/utilities/string.js +8 -6
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/substitutions.js +7 -5
- package/src/utilities/verification.js +29 -13
- package/src/verifier/combinator.js +3 -3
- package/src/verifier/constructor.js +3 -3
- package/src/verifier/topLevel.js +20 -21
- package/lib/assertion/contained.js +0 -232
- package/lib/assertion/defined.js +0 -211
- package/lib/assertion/subproof.js +0 -203
- package/lib/assertion/type.js +0 -185
- package/lib/conclusion.js +0 -130
- package/lib/consequent.js +0 -130
- package/lib/declaration/combinator.js +0 -90
- package/lib/declaration/constructor.js +0 -90
- package/lib/declaration/metavariable.js +0 -104
- package/lib/declaration/type.js +0 -90
- package/lib/declaration/variable.js +0 -105
- package/lib/derivation.js +0 -91
- package/lib/equality.js +0 -209
- package/lib/error.js +0 -70
- package/lib/frame.js +0 -331
- package/lib/judgement.js +0 -147
- package/lib/label.js +0 -141
- package/lib/metaType.js +0 -255
- package/lib/metatheorem.js +0 -263
- package/lib/metavariable.js +0 -399
- package/lib/mixins/statement/qualified/unify.js +0 -69
- package/lib/mixins/statement/unify.js +0 -42
- package/lib/mixins/statement/unifyIndependenntly.js +0 -46
- package/lib/mixins/term/unify.js +0 -40
- package/lib/premise.js +0 -184
- package/lib/proof.js +0 -103
- package/lib/proofStep.js +0 -179
- package/lib/reference.js +0 -145
- package/lib/rule.js +0 -259
- package/lib/shim.js +0 -14
- package/lib/statement/qualified.js +0 -152
- package/lib/statement/unqualified.js +0 -175
- package/lib/statement.js +0 -270
- package/lib/subDerivation.js +0 -91
- package/lib/subproof.js +0 -181
- package/lib/supposition.js +0 -184
- package/lib/term.js +0 -318
- package/lib/topLevelAssertion.js +0 -305
- package/lib/type.js +0 -321
- package/lib/utilities/equivalences.js +0 -178
- package/lib/variable.js +0 -281
- package/src/conclusion.js +0 -96
- package/src/consequent.js +0 -96
- package/src/mixins/statement/qualified/unify.js +0 -103
- package/src/mixins/statement/unify.js +0 -41
- package/src/mixins/statement/unifyIndependenntly.js +0 -58
- package/src/mixins/term/unify.js +0 -36
- package/src/premise.js +0 -183
- package/src/proofStep.js +0 -181
- package/src/shim.js +0 -5
- package/src/statement/qualified.js +0 -133
- package/src/statement/unqualified.js +0 -166
- package/src/supposition.js +0 -183
- package/src/utilities/equivalences.js +0 -183
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
import shim from "../shim";
|
|
6
|
-
import LocalContext from "../context/local";
|
|
7
|
-
|
|
8
|
-
import { trim } from "../utilities/string";
|
|
9
|
-
import { nodeQuery } from "../utilities/query";
|
|
10
|
-
import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
|
|
11
|
-
|
|
12
|
-
const { reverse } = arrayUtilities;
|
|
13
|
-
|
|
14
|
-
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement");
|
|
15
|
-
|
|
16
|
-
class UnqualifiedStatement {
|
|
17
|
-
constructor(string, statement) {
|
|
18
|
-
this.string = string;
|
|
19
|
-
this.statement = statement;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getString() {
|
|
23
|
-
return this.string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getStatement() {
|
|
27
|
-
return this.statement;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
matchStatementNode(statementNode) { return this.statement.matchStatementNode(statementNode); }
|
|
31
|
-
|
|
32
|
-
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
33
|
-
let statementUnified;
|
|
34
|
-
|
|
35
|
-
const statementString = statement.getString(),
|
|
36
|
-
unqualifiedStatement = this, ///
|
|
37
|
-
unqualifiedStatementString = unqualifiedStatement.getString(); ///
|
|
38
|
-
|
|
39
|
-
specificContext.trace(`Unifying the '${statementString}' statement with the '${unqualifiedStatementString}' unqualified statement...`);
|
|
40
|
-
|
|
41
|
-
statementUnified = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
42
|
-
|
|
43
|
-
if (statementUnified) {
|
|
44
|
-
specificContext.debug(`...unified the '${statementString}' statement with the '${unqualifiedStatementString}' unqualified statement.`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return statementUnified;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
unifyIndependently(substitutions, generalContext, specificContext) {
|
|
51
|
-
let unifiedIndependently;
|
|
52
|
-
|
|
53
|
-
const unqualifiedStatement = this, ///
|
|
54
|
-
unqualifiedStatementString = unqualifiedStatement.getString(); ///
|
|
55
|
-
|
|
56
|
-
specificContext.trace(`Unifying the '${unqualifiedStatementString}' unqualified statement independently...`);
|
|
57
|
-
|
|
58
|
-
const statementResolvedIndependently = this.statement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
59
|
-
|
|
60
|
-
unifiedIndependently = statementResolvedIndependently; ///
|
|
61
|
-
|
|
62
|
-
if (unifiedIndependently) {
|
|
63
|
-
specificContext.debug(`...unified the '${unqualifiedStatementString}' unqualified statement independently.`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return unifiedIndependently;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
unifyStatementWithProofSteps(statement, assignments, stated, context) {
|
|
70
|
-
let statementUnifiedWithProofSteps;
|
|
71
|
-
|
|
72
|
-
let proofSteps = context.getProofSteps();
|
|
73
|
-
|
|
74
|
-
proofSteps = reverse(proofSteps); ///
|
|
75
|
-
|
|
76
|
-
statementUnifiedWithProofSteps = proofSteps.some((proofStep) => {
|
|
77
|
-
const statementUnified = proofStep.unifyStatement(statement, context);
|
|
78
|
-
|
|
79
|
-
if (statementUnified) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return statementUnifiedWithProofSteps;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
verify(assignments, stated, context) {
|
|
88
|
-
let verified;
|
|
89
|
-
|
|
90
|
-
const unqualifiedStatement = this, ///
|
|
91
|
-
unqualifiedStatementString = unqualifiedStatement.getString(); ///
|
|
92
|
-
|
|
93
|
-
if (this.statement !== null) {
|
|
94
|
-
context.trace(`Verifying the '${unqualifiedStatementString}' unqualified statement...`);
|
|
95
|
-
|
|
96
|
-
const statementVerified = this.statement.verify(assignments, stated, context);
|
|
97
|
-
|
|
98
|
-
if (statementVerified) {
|
|
99
|
-
verified = true;
|
|
100
|
-
} else {
|
|
101
|
-
const statementUnifiedWithProofSteps = this.unifyStatementWithProofSteps(this.statement, assignments, stated, context);
|
|
102
|
-
|
|
103
|
-
if (statementUnifiedWithProofSteps) {
|
|
104
|
-
verified = true;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (verified) {
|
|
109
|
-
context.debug(`...verified the '${unqualifiedStatementString}' unqualified statement.`);
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
context.debug(`Cannot verify the '${unqualifiedStatementString}' unqualified statement because it is nonsense.`);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return verified;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
toJSON() {
|
|
119
|
-
const statementJSON = statementToStatementJSON(this.statement),
|
|
120
|
-
statement = statementJSON, ///
|
|
121
|
-
string = this.string, ///
|
|
122
|
-
json = {
|
|
123
|
-
string,
|
|
124
|
-
statement
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
return json;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
static fromJSON(json, fileContext) {
|
|
131
|
-
const { string } = json,
|
|
132
|
-
statement = statementFromJSON(json, fileContext),
|
|
133
|
-
unqualifiedStatement = new UnqualifiedStatement(string, statement);
|
|
134
|
-
|
|
135
|
-
return unqualifiedStatement;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
static fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext) {
|
|
139
|
-
let unqualifiedStatement = null;
|
|
140
|
-
|
|
141
|
-
if (unqualifiedStatementNode !== null) {
|
|
142
|
-
let string;
|
|
143
|
-
|
|
144
|
-
const { Statement } = shim,
|
|
145
|
-
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
146
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
147
|
-
context = localContext, ///
|
|
148
|
-
statement = Statement.fromStatementNode(statementNode, context),
|
|
149
|
-
node = unqualifiedStatementNode; ///
|
|
150
|
-
|
|
151
|
-
string = fileContext.nodeAsString(node);
|
|
152
|
-
|
|
153
|
-
string = trim(string); ///
|
|
154
|
-
|
|
155
|
-
unqualifiedStatement = new UnqualifiedStatement(string, statement);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return unqualifiedStatement;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
Object.assign(shim, {
|
|
163
|
-
UnqualifiedStatement
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
export default UnqualifiedStatement;
|
package/src/supposition.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import shim from "./shim";
|
|
4
|
-
|
|
5
|
-
import { nodeQuery } from "./utilities/query";
|
|
6
|
-
import { assignAssignments } from "./utilities/assignments";
|
|
7
|
-
import { subproofAssertionFromStatement } from "./utilities/verification";
|
|
8
|
-
import { unqualifiedStatementFromJSON, unqualifiedStatementToUnqualifiedStatementJSON } from "./utilities/json";
|
|
9
|
-
|
|
10
|
-
const unqualifiedStatementNodeQuery = nodeQuery("/supposition/unqualifiedStatement");
|
|
11
|
-
|
|
12
|
-
class Supposition {
|
|
13
|
-
constructor(unqualifiedStatement) {
|
|
14
|
-
this.unqualifiedStatement = unqualifiedStatement;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
getUnqualifiedStatement() {
|
|
18
|
-
return this.unqualifiedStatement;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getString() { return this.unqualifiedStatement.getString(); }
|
|
22
|
-
|
|
23
|
-
getStatement() { return this.unqualifiedStatement.getStatement(); }
|
|
24
|
-
|
|
25
|
-
unifyIndependently(substitutions, generalContext, specificContext) {
|
|
26
|
-
let unifiedIndependently;
|
|
27
|
-
|
|
28
|
-
const supposition = this, ///
|
|
29
|
-
suppositionString = supposition.getString();
|
|
30
|
-
|
|
31
|
-
specificContext.trace(`Unifying the '${suppositionString}' supposition independently...`);
|
|
32
|
-
|
|
33
|
-
const unqualifiedStatementResolvedIndependently = this.unqualifiedStatement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
34
|
-
|
|
35
|
-
unifiedIndependently = unqualifiedStatementResolvedIndependently; ///
|
|
36
|
-
|
|
37
|
-
if (unifiedIndependently) {
|
|
38
|
-
specificContext.trace(`...unified the '${suppositionString}' supposition independently.`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return unifiedIndependently;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
unifyProofStep(proofStep, substitutions, generalContext, specificContext) {
|
|
45
|
-
let proofStepUnified = false;
|
|
46
|
-
|
|
47
|
-
const subproof = proofStep.getSubproof(),
|
|
48
|
-
statement = proofStep.getStatement();
|
|
49
|
-
|
|
50
|
-
substitutions.snapshot();
|
|
51
|
-
|
|
52
|
-
let subproofUnified = false,
|
|
53
|
-
statementUnified = false;
|
|
54
|
-
|
|
55
|
-
if (false) {
|
|
56
|
-
///
|
|
57
|
-
} else if (subproof !== null) {
|
|
58
|
-
subproofUnified = this.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
59
|
-
} else if (statement !== null) {
|
|
60
|
-
statementUnified = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (subproofUnified || statementUnified) {
|
|
64
|
-
substitutions.resolve(generalContext, specificContext);
|
|
65
|
-
|
|
66
|
-
proofStepUnified = true;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const context = specificContext; ///
|
|
70
|
-
|
|
71
|
-
proofStepUnified ?
|
|
72
|
-
substitutions.continue() :
|
|
73
|
-
substitutions.rollback(context);
|
|
74
|
-
|
|
75
|
-
return proofStepUnified;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
79
|
-
let statementUnified;
|
|
80
|
-
|
|
81
|
-
const supposition = this, ///
|
|
82
|
-
suppositionString = supposition.getString(),
|
|
83
|
-
statementString = statement.getString();
|
|
84
|
-
|
|
85
|
-
specificContext.trace(`Unifying the '${statementString}' statement with the '${suppositionString}' supposition...`);
|
|
86
|
-
|
|
87
|
-
statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
88
|
-
|
|
89
|
-
if (statementUnified) {
|
|
90
|
-
specificContext.debug(`...unified the '${statementString}' statement with the '${suppositionString}' supposition.`);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return statementUnified;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
97
|
-
let subproofUnified = false;
|
|
98
|
-
|
|
99
|
-
const supposition = this, ///
|
|
100
|
-
subproofString = subproof.getString(),
|
|
101
|
-
suppositionStatement = supposition.getStatement(),
|
|
102
|
-
suppositionStatementString = suppositionStatement.getString();
|
|
103
|
-
|
|
104
|
-
specificContext.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
|
|
105
|
-
|
|
106
|
-
const context = generalContext, ///
|
|
107
|
-
statement = this.unqualifiedStatement.getStatement(),
|
|
108
|
-
subproofAssertion = subproofAssertionFromStatement(statement, context);
|
|
109
|
-
|
|
110
|
-
if (subproofAssertion !== null) {
|
|
111
|
-
subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (subproofUnified) {
|
|
115
|
-
specificContext.debug(`...unified the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement.`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return subproofUnified;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
verify(context) {
|
|
122
|
-
let verified = false;
|
|
123
|
-
|
|
124
|
-
const suppositionString = this.getString(); ///
|
|
125
|
-
|
|
126
|
-
context.trace(`Verifying the '${suppositionString}' supposition...`);
|
|
127
|
-
|
|
128
|
-
const stated = true,
|
|
129
|
-
assignments = [],
|
|
130
|
-
unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, context);
|
|
131
|
-
|
|
132
|
-
if (unqualifiedStatementVerified) {
|
|
133
|
-
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
134
|
-
|
|
135
|
-
if (assignmentsAssigned) {
|
|
136
|
-
const { ProofStep } = shim,
|
|
137
|
-
proofStep = ProofStep.fromUnqualifiedStatement(this.unqualifiedStatement);
|
|
138
|
-
|
|
139
|
-
context.addProofStep(proofStep);
|
|
140
|
-
|
|
141
|
-
verified = true;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (verified) {
|
|
146
|
-
context.debug(`...verified the '${suppositionString}' supposition.`);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return verified;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
toJSON() {
|
|
153
|
-
const unqualifiedStatementJSON = unqualifiedStatementToUnqualifiedStatementJSON(this.unqualifiedStatement),
|
|
154
|
-
unqualifiedStatement = unqualifiedStatementJSON, ///
|
|
155
|
-
json = {
|
|
156
|
-
unqualifiedStatement
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
return json;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
static fromJSON(json, fileContext) {
|
|
163
|
-
const unqualifiedStatement = unqualifiedStatementFromJSON(json, fileContext),
|
|
164
|
-
supposition = new Supposition(unqualifiedStatement);
|
|
165
|
-
|
|
166
|
-
return supposition;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
static fromSuppositionNode(suppositionNode, fileContext) {
|
|
170
|
-
const { UnqualifiedStatement } = shim,
|
|
171
|
-
unqualifiedStatementNode = unqualifiedStatementNodeQuery(suppositionNode),
|
|
172
|
-
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
|
|
173
|
-
supposition = new Supposition(unqualifiedStatement);
|
|
174
|
-
|
|
175
|
-
return supposition
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
Object.assign(shim, {
|
|
180
|
-
Supposition
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
export default Supposition;
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
import Equivalence from "../equivalence";
|
|
6
|
-
|
|
7
|
-
const { push, compress, separate } = arrayUtilities;
|
|
8
|
-
|
|
9
|
-
export function mergeEquivalences(equivalencesA, equivalencesB) {
|
|
10
|
-
const typesA = typesFromEquivalences(equivalencesA),
|
|
11
|
-
typesB = typesFromEquivalences(equivalencesB),
|
|
12
|
-
types = [
|
|
13
|
-
...typesA,
|
|
14
|
-
...typesB
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
compress(types, (typeA, typeB) => {
|
|
18
|
-
if (typeA === typeB) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const equivalences = types.map((type) => {
|
|
24
|
-
let equivalence;
|
|
25
|
-
|
|
26
|
-
const equivalenceA = findEquivalenceByType(equivalencesA, type),
|
|
27
|
-
equivalenceB = findEquivalenceByType(equivalencesB, type);
|
|
28
|
-
|
|
29
|
-
if ((equivalenceA !== null) && (equivalenceB !== null)) {
|
|
30
|
-
const leftEquivalence = equivalenceA, ///
|
|
31
|
-
rightEquivalence = equivalenceB; ///
|
|
32
|
-
|
|
33
|
-
equivalence = Equivalence.merge(leftEquivalence, rightEquivalence);
|
|
34
|
-
} else if (equivalenceA !== null) {
|
|
35
|
-
equivalence = equivalenceA; ///
|
|
36
|
-
} else if (equivalenceB !== null) {
|
|
37
|
-
equivalence = equivalenceB; ///
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return equivalence;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return equivalences;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function findEquivalenceByType(equivalences, type) {
|
|
47
|
-
const equivalence = equivalences.find((equivalence) => {
|
|
48
|
-
const equivalenceMatchesType = equivalence.matchType(type);
|
|
49
|
-
|
|
50
|
-
if (equivalenceMatchesType) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
}) || null;
|
|
54
|
-
|
|
55
|
-
return equivalence;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function findEquivalenceByTerm(equivalences, term) {
|
|
59
|
-
const equivalence = equivalences.find((equivalence) => {
|
|
60
|
-
const termEquates = equivalence.equateTerm(term);
|
|
61
|
-
|
|
62
|
-
if (termEquates) {
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
}) || null;
|
|
66
|
-
|
|
67
|
-
return equivalence;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function findEquivalenceByTermNodes(equivalences, termNodes) {
|
|
71
|
-
const equivalence = equivalences.find((equivalence) => {
|
|
72
|
-
const equivalenceMatchesTerms = equivalence.matchTermNodes(termNodes);
|
|
73
|
-
|
|
74
|
-
if (equivalenceMatchesTerms) {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
}) || null;
|
|
78
|
-
|
|
79
|
-
return equivalence;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function groundedTermsAndDefinedVariablesFromFromEquivalences(equivalences, groundedTerms, definedVariables, context) {
|
|
83
|
-
let groundedEquivalences,
|
|
84
|
-
remainingEquivalences,
|
|
85
|
-
initiallyGroundedEquivalences,
|
|
86
|
-
implicitlyGroundedEquivalences;
|
|
87
|
-
|
|
88
|
-
remainingEquivalences = [];
|
|
89
|
-
|
|
90
|
-
initiallyGroundedEquivalences = [];
|
|
91
|
-
|
|
92
|
-
separateInitiallyGroundedEquivalences(equivalences, remainingEquivalences, initiallyGroundedEquivalences, context);
|
|
93
|
-
|
|
94
|
-
const initiallyGroundedEquivalencesLength = initiallyGroundedEquivalences.length;
|
|
95
|
-
|
|
96
|
-
if (initiallyGroundedEquivalencesLength > 0) {
|
|
97
|
-
groundedEquivalences = initiallyGroundedEquivalences; ///
|
|
98
|
-
|
|
99
|
-
let implicitlyGroundedEquivalencesLength = 1;
|
|
100
|
-
|
|
101
|
-
while (implicitlyGroundedEquivalencesLength > 0) {
|
|
102
|
-
let definedVariablesLength = 0,
|
|
103
|
-
previousDefinedVariablesLength = -1;
|
|
104
|
-
|
|
105
|
-
while (definedVariablesLength > previousDefinedVariablesLength) {
|
|
106
|
-
previousDefinedVariablesLength = definedVariablesLength; ///
|
|
107
|
-
|
|
108
|
-
groundedTermsFromGroundedEquivalencesAndDefinedVariables(groundedEquivalences, definedVariables, groundedTerms, context);
|
|
109
|
-
|
|
110
|
-
definedVariablesFromGroundedTerms(groundedTerms, definedVariables, context);
|
|
111
|
-
|
|
112
|
-
definedVariablesLength = definedVariables.length;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
equivalences = remainingEquivalences; ///
|
|
116
|
-
|
|
117
|
-
remainingEquivalences = [];
|
|
118
|
-
|
|
119
|
-
implicitlyGroundedEquivalences = [];
|
|
120
|
-
|
|
121
|
-
separateImplicitlyGroundedEquivalences(equivalences, remainingEquivalences, implicitlyGroundedEquivalences, definedVariables, context);
|
|
122
|
-
|
|
123
|
-
push(groundedEquivalences, implicitlyGroundedEquivalences);
|
|
124
|
-
|
|
125
|
-
implicitlyGroundedEquivalencesLength = implicitlyGroundedEquivalences.length; ///
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function typesFromEquivalences(equivalences) {
|
|
131
|
-
const types = equivalences.map((equivalence) => {
|
|
132
|
-
const type = equivalence.getType();
|
|
133
|
-
|
|
134
|
-
return type;
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
return types;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function definedVariablesFromGroundedTerms(groundedTerms, definedVariables, context) {
|
|
141
|
-
const terms = groundedTerms, ///
|
|
142
|
-
variables = definedVariables; ///
|
|
143
|
-
|
|
144
|
-
terms.forEach((term) => {
|
|
145
|
-
const termVariables = term.getVariables(context);
|
|
146
|
-
|
|
147
|
-
termVariables.forEach((termVariable) => {
|
|
148
|
-
const variablesIncludesTermVariable = variables.includes(termVariable);
|
|
149
|
-
|
|
150
|
-
if (!variablesIncludesTermVariable) {
|
|
151
|
-
const variable = termVariable; ///
|
|
152
|
-
|
|
153
|
-
variables.push(variable);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function separateInitiallyGroundedEquivalences(equivalences, remainingEquivalences, initiallyGroundedEquivalences, context) {
|
|
160
|
-
separate(equivalences, remainingEquivalences, initiallyGroundedEquivalences, (equivalence) => {
|
|
161
|
-
const equivalenceInitiallyGrounded = equivalence.isInitiallyGrounded(context);
|
|
162
|
-
|
|
163
|
-
if (!equivalenceInitiallyGrounded) {
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function separateImplicitlyGroundedEquivalences(equivalences, remainingEquivalences, implicitlyGroundedEquivalences, definedVariables, context) {
|
|
170
|
-
separate(equivalences, remainingEquivalences, implicitlyGroundedEquivalences, (equivalence) => {
|
|
171
|
-
const equivalenceImplicitlyGrounded = equivalence.isImplicitlyGrounded(definedVariables, context);
|
|
172
|
-
|
|
173
|
-
if (!equivalenceImplicitlyGrounded) {
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function groundedTermsFromGroundedEquivalencesAndDefinedVariables(groundedEquivalences, definedVariables, groundedTerms, context) {
|
|
180
|
-
groundedEquivalences.forEach((groundedEquivalence) => {
|
|
181
|
-
groundedEquivalence.getGroundedTerms(definedVariables, groundedTerms, context);
|
|
182
|
-
});
|
|
183
|
-
}
|