occam-verify-cli 0.0.1111 → 0.0.1112
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 +246 -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 +10 -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,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { definedAssertionFromStatement, containedAssertionFromStatement } from "../../utilities/verification";
|
|
4
|
-
|
|
5
|
-
function unifyIndependentlyAsDefinedAssertion(statement, substitutions, generalContext, specificContext) {
|
|
6
|
-
let unifiedIndependentlyAsDefinedAssertion = false;
|
|
7
|
-
|
|
8
|
-
const context = generalContext, ///
|
|
9
|
-
definedAssertion = definedAssertionFromStatement(statement, context);
|
|
10
|
-
|
|
11
|
-
if (definedAssertion !== null) {
|
|
12
|
-
const statementString = statement.getString();
|
|
13
|
-
|
|
14
|
-
specificContext.trace(`Unifying the '${statementString}' statement as a defined assertion independently...`);
|
|
15
|
-
|
|
16
|
-
const context = specificContext, ///
|
|
17
|
-
definedAssertionUnifiedIndependently = definedAssertion.unifyIndependently(substitutions, context);
|
|
18
|
-
|
|
19
|
-
unifiedIndependentlyAsDefinedAssertion = definedAssertionUnifiedIndependently; ///
|
|
20
|
-
|
|
21
|
-
if (unifiedIndependentlyAsDefinedAssertion) {
|
|
22
|
-
specificContext.debug(`...unified the '${statementString}' statement as a defined assertion independently.`);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return unifiedIndependentlyAsDefinedAssertion;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function unifyIndependentlyAsContainedAssertion(statement, substitutions, generalContext, specificContext) {
|
|
30
|
-
let unifiedIndependentlyAsContainedAssertion = false;
|
|
31
|
-
|
|
32
|
-
const context = generalContext, ///
|
|
33
|
-
containedAssertion = containedAssertionFromStatement(statement, context);
|
|
34
|
-
|
|
35
|
-
if (containedAssertion !== null) {
|
|
36
|
-
const statementString = statement.getString();
|
|
37
|
-
|
|
38
|
-
specificContext.trace(`Unifying the '${statementString}' statement as a contained assertion independently...`);
|
|
39
|
-
|
|
40
|
-
const context = specificContext, ///
|
|
41
|
-
containedAssertionUnifiedIndependently = containedAssertion.unifyIndependently(substitutions, context);
|
|
42
|
-
|
|
43
|
-
unifiedIndependentlyAsContainedAssertion = containedAssertionUnifiedIndependently; ///
|
|
44
|
-
|
|
45
|
-
if (unifiedIndependentlyAsContainedAssertion) {
|
|
46
|
-
specificContext.debug(`...unified the '${statementString}' statement as a contained assertion independently.`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return unifiedIndependentlyAsContainedAssertion;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const unifyIndependentlyMixins = [
|
|
54
|
-
unifyIndependentlyAsDefinedAssertion,
|
|
55
|
-
unifyIndependentlyAsContainedAssertion
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
export default unifyIndependentlyMixins;
|
package/src/mixins/term/unify.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import BracketedConstructor from "../../constructor/bracketed";
|
|
4
|
-
|
|
5
|
-
function unifyWithBracketedConstructor(term, context, verifyAhead) {
|
|
6
|
-
let unifiedWithBracketedConstructor;
|
|
7
|
-
|
|
8
|
-
const bracketedConstructor = BracketedConstructor.fromNothing();
|
|
9
|
-
|
|
10
|
-
unifiedWithBracketedConstructor = bracketedConstructor.unifyTerm(term, context, verifyAhead);
|
|
11
|
-
|
|
12
|
-
return unifiedWithBracketedConstructor;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function unifyWithConstructors(term, context, verifyAhead) {
|
|
16
|
-
let unifiedWithConstructors;
|
|
17
|
-
|
|
18
|
-
const constructors = context.getConstructors();
|
|
19
|
-
|
|
20
|
-
unifiedWithConstructors = constructors.some((constructor) => {
|
|
21
|
-
const unifiedWithConstructor = constructor.unifyTerm(term, context, verifyAhead);
|
|
22
|
-
|
|
23
|
-
if (unifiedWithConstructor) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return unifiedWithConstructors;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const unifyMixins = [
|
|
32
|
-
unifyWithBracketedConstructor,
|
|
33
|
-
unifyWithConstructors
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
export default unifyMixins;
|
package/src/premise.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("/premise/unqualifiedStatement");
|
|
11
|
-
|
|
12
|
-
class Premise {
|
|
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 premise = this, ///
|
|
29
|
-
premiseString = premise.getString();
|
|
30
|
-
|
|
31
|
-
specificContext.trace(`Unifying the '${premiseString}' premise independently...`);
|
|
32
|
-
|
|
33
|
-
const unqualifiedStatementResolvedIndependently = this.unqualifiedStatement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
34
|
-
|
|
35
|
-
unifiedIndependently = unqualifiedStatementResolvedIndependently; ///
|
|
36
|
-
|
|
37
|
-
if (unifiedIndependently) {
|
|
38
|
-
specificContext.trace(`...unified the '${premiseString}' premise 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 premise = this, ///
|
|
82
|
-
premiseString = premise.getString(),
|
|
83
|
-
statementString = statement.getString();
|
|
84
|
-
|
|
85
|
-
specificContext.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`);
|
|
86
|
-
|
|
87
|
-
statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
88
|
-
|
|
89
|
-
if (statementUnified) {
|
|
90
|
-
specificContext.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return statementUnified;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
97
|
-
let subproofUnified = false;
|
|
98
|
-
|
|
99
|
-
const premise = this, ///
|
|
100
|
-
subproofString = subproof.getString(),
|
|
101
|
-
premiseStatement = premise.getStatement(),
|
|
102
|
-
premiseStatementString = premiseStatement.getString();
|
|
103
|
-
|
|
104
|
-
specificContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' 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 premise's '${premiseStatementString}' statement.`);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return subproofUnified;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
verify(context) {
|
|
122
|
-
let verified = false;
|
|
123
|
-
|
|
124
|
-
const premiseString = this.getString(); ///
|
|
125
|
-
|
|
126
|
-
context.trace(`Verifying the '${premiseString}' premise...`);
|
|
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 '${premiseString}' premise.`);
|
|
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
|
-
premise = new Premise(unqualifiedStatement);
|
|
165
|
-
|
|
166
|
-
return premise;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
static fromPremiseNode(suppositionNode, fileContext) {
|
|
170
|
-
const { UnqualifiedStatement } = shim,
|
|
171
|
-
unqualifiedStatementNode = unqualifiedStatementNodeQuery(suppositionNode),
|
|
172
|
-
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
|
|
173
|
-
premise = new Premise(unqualifiedStatement);
|
|
174
|
-
|
|
175
|
-
return premise
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
Object.assign(shim, {
|
|
180
|
-
Premise
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
export default Premise;
|
package/src/proofStep.js
DELETED
|
@@ -1,181 +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
|
-
|
|
8
|
-
const subproofNodeQuery = nodeQuery("/proofStep/subproof"),
|
|
9
|
-
statementNodeQuery = nodeQuery("/proofStep|lastProofStep/statement"),
|
|
10
|
-
referenceNodeQuery = nodeQuery("/proofStep|lastProofStep/reference");
|
|
11
|
-
|
|
12
|
-
class ProofStep {
|
|
13
|
-
constructor(subproof, statement, reference) {
|
|
14
|
-
this.subproof = subproof;
|
|
15
|
-
this.statement = statement;
|
|
16
|
-
this.reference = reference;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
getSubproof() {
|
|
20
|
-
return this.subproof;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
getQualifiedStatement() {
|
|
24
|
-
return this.qualifiedStatement;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getUnqualifiedStatement() {
|
|
28
|
-
return this.unqualifiedStatement;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getStatement() {
|
|
32
|
-
let statement = null;
|
|
33
|
-
|
|
34
|
-
if (this.qualifiedStatement !== null) {
|
|
35
|
-
statement = this.qualifiedStatement.getStatement();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (this.unqualifiedStatement !== null) {
|
|
39
|
-
statement = this.unqualifiedStatement.getStatement();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return statement;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
unifyStatement(statement, context) {
|
|
46
|
-
let statementUnified = false;
|
|
47
|
-
|
|
48
|
-
if ((this.qualifiedStatement !== null) || (this.unqualifiedStatement !== null)) {
|
|
49
|
-
const statementString = statement.getString();
|
|
50
|
-
|
|
51
|
-
context.trace(`Unifying the '${statementString}' statement...`);
|
|
52
|
-
|
|
53
|
-
const { Substitutions } = shim,
|
|
54
|
-
specificContext = context, ///
|
|
55
|
-
generalContext = context, ///
|
|
56
|
-
substitutions = Substitutions.fromNothing();
|
|
57
|
-
|
|
58
|
-
if (this.qualifiedStatement !== null) {
|
|
59
|
-
statementUnified = this.qualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (this.unqualifiedStatement !== null) {
|
|
63
|
-
statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const substitutionsLength = substitutions.getLength();
|
|
67
|
-
|
|
68
|
-
if (substitutionsLength > 0) {
|
|
69
|
-
statementUnified = false;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (statementUnified) {
|
|
73
|
-
context.debug(`...unified the '${statementString}' statement.`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return statementUnified;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
unifySubproofAssertion(subproofAssertion, context) {
|
|
81
|
-
let subproofAssertionUnified = false;
|
|
82
|
-
|
|
83
|
-
if (this.subproof !== null) {
|
|
84
|
-
const subproofAssertionString = subproofAssertion.getString();
|
|
85
|
-
|
|
86
|
-
context.trace(`Unifying the '${subproofAssertionString}' subproof assertion...`);
|
|
87
|
-
|
|
88
|
-
const { Substitutions } = shim,
|
|
89
|
-
specificContext = context, ///
|
|
90
|
-
generalContext = context, ///
|
|
91
|
-
substitutions = Substitutions.fromNothing();
|
|
92
|
-
|
|
93
|
-
subproofAssertionUnified = this.subproof.unifySubproofAssertion(subproofAssertion, substitutions, generalContext, specificContext);
|
|
94
|
-
|
|
95
|
-
if (subproofAssertionUnified) {
|
|
96
|
-
const substitutionsLength = substitutions.getLength();
|
|
97
|
-
|
|
98
|
-
if (substitutionsLength > 0) {
|
|
99
|
-
subproofAssertionUnified = false;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (subproofAssertionUnified) {
|
|
104
|
-
context.debug(`...unified the '${subproofAssertionString}' subproof assertion.`);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return subproofAssertionUnified;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
verify(substitutions, context) {
|
|
112
|
-
let verified = false;
|
|
113
|
-
|
|
114
|
-
let stated = false;
|
|
115
|
-
|
|
116
|
-
const assignments = [];
|
|
117
|
-
|
|
118
|
-
let subproofVerified = false,
|
|
119
|
-
qualifiedStatementVerified = false,
|
|
120
|
-
unqualifiedStatementVerified = false;
|
|
121
|
-
|
|
122
|
-
if (this.subproof !== null) {
|
|
123
|
-
subproofVerified = this.subproof.verify(substitutions, context);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (this.qualifiedStatement !== null) {
|
|
127
|
-
stated = true;
|
|
128
|
-
|
|
129
|
-
qualifiedStatementVerified = this.qualifiedStatement.verify(substitutions, assignments, stated, context);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (this.unqualifiedStatement !== null) {
|
|
133
|
-
stated = false;
|
|
134
|
-
|
|
135
|
-
unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, context);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (subproofVerified || qualifiedStatementVerified || unqualifiedStatementVerified) {
|
|
139
|
-
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
140
|
-
|
|
141
|
-
if (assignmentsAssigned) {
|
|
142
|
-
verified = true;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (verified) {
|
|
147
|
-
const proofStep = this; ///
|
|
148
|
-
|
|
149
|
-
context.addProofStep(proofStep);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return verified;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
static fromProofStepNode(proofStepNode, fileContext) {
|
|
156
|
-
const { Subproof, QualifiedStatement, UnqualifiedStatement } = shim,
|
|
157
|
-
subproofNode = subproofNodeQuery(proofStepNode),
|
|
158
|
-
qualifiedStatementNode = qualifiedStatementNodeQuery(proofStepNode),
|
|
159
|
-
unqualifiedStatementNode = unqualifiedStatementNodeQuery(proofStepNode),
|
|
160
|
-
subproof = Subproof.fromSubproofNode(subproofNode, fileContext),
|
|
161
|
-
qualifiedStatement = QualifiedStatement.fromQualifiedStatementNode(qualifiedStatementNode, fileContext),
|
|
162
|
-
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
|
|
163
|
-
proofStep = new ProofStep(subproof, qualifiedStatement, unqualifiedStatement);
|
|
164
|
-
|
|
165
|
-
return proofStep;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
static fromUnqualifiedStatement(unqualifiedStatement) {
|
|
169
|
-
const subproof = null,
|
|
170
|
-
qualifiedStatement = null,
|
|
171
|
-
proofStep = new ProofStep(subproof, qualifiedStatement, unqualifiedStatement);
|
|
172
|
-
|
|
173
|
-
return proofStep;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
Object.assign(shim, {
|
|
178
|
-
ProofStep
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
export default ProofStep;
|
package/src/shim.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import shim from "../shim";
|
|
4
|
-
import Reference from "../reference";
|
|
5
|
-
import unifyMixins from "../mixins/statement/qualified/unify";
|
|
6
|
-
import LocalContext from "../context/local";
|
|
7
|
-
|
|
8
|
-
import { trim } from "../utilities/string";
|
|
9
|
-
import { nodeQuery } from "../utilities/query";
|
|
10
|
-
import { assignAssignments } from "../utilities/assignments";
|
|
11
|
-
|
|
12
|
-
const statementNodeQuery = nodeQuery("/qualifiedStatement/statement");
|
|
13
|
-
|
|
14
|
-
class QualifiedStatement {
|
|
15
|
-
constructor(string, statement, reference) {
|
|
16
|
-
this.string = string;
|
|
17
|
-
this.statement = statement;
|
|
18
|
-
this.reference = reference;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getString() {
|
|
22
|
-
return this.string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getStatement() {
|
|
26
|
-
return this.statement;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getReference() {
|
|
30
|
-
return this.reference;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getMetavariableNode() { return this.reference.getMetavariableNode(); }
|
|
34
|
-
|
|
35
|
-
unify(substitutions, context) {
|
|
36
|
-
let unified;
|
|
37
|
-
|
|
38
|
-
const qualifiedStatementString = this.string; ///
|
|
39
|
-
|
|
40
|
-
context.trace(`Unifying the '${qualifiedStatementString}' qualified statement...`);
|
|
41
|
-
|
|
42
|
-
unified = unifyMixins.some((unifyMixin) => {
|
|
43
|
-
const qualifiedStatement = this, ///
|
|
44
|
-
unified = unifyMixin(qualifiedStatement, substitutions, context);
|
|
45
|
-
|
|
46
|
-
return unified;
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (unified) {
|
|
50
|
-
context.debug(`...unified the '${qualifiedStatementString}' qualified statement.`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return unified;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
57
|
-
let statementUnified;
|
|
58
|
-
|
|
59
|
-
const statementString = statement.getString(),
|
|
60
|
-
unqualifiedStatementString = this.getString(); ///
|
|
61
|
-
|
|
62
|
-
specificContext.trace(`Unifying the '${statementString}' statement with the '${unqualifiedStatementString}' qualified statement...`);
|
|
63
|
-
|
|
64
|
-
statementUnified = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
65
|
-
|
|
66
|
-
if (statementUnified) {
|
|
67
|
-
specificContext.debug(`...unified the '${statementString}' statement with the '${unqualifiedStatementString}' qualified statement.`);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return statementUnified;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
verify(substitutions, assignments, stated, context) {
|
|
74
|
-
let verified;
|
|
75
|
-
|
|
76
|
-
const qualifiedStatementString = this.string; ///
|
|
77
|
-
|
|
78
|
-
if (this.statement !== null) {
|
|
79
|
-
context.trace(`Verifying the '${qualifiedStatementString}' qualified statement...`);
|
|
80
|
-
|
|
81
|
-
const statementVerified = this.statement.verify(assignments, stated, context);
|
|
82
|
-
|
|
83
|
-
if (statementVerified) {
|
|
84
|
-
const unified = this.unify(substitutions, context);
|
|
85
|
-
|
|
86
|
-
if (unified) {
|
|
87
|
-
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
88
|
-
|
|
89
|
-
verified = assignmentsAssigned; ///
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (verified) {
|
|
94
|
-
context.debug(`...verified the '${qualifiedStatementString}' qualified statement.`);
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
context.debug(`Cannot verify the '${qualifiedStatementString}' qualified statement because it is nonsense.`);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return verified;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
static fromQualifiedStatementNode(qualifiedStatementNode, fileContext) {
|
|
104
|
-
let qualifiedStatement = null;
|
|
105
|
-
|
|
106
|
-
if (qualifiedStatementNode !== null) {
|
|
107
|
-
let string;
|
|
108
|
-
|
|
109
|
-
const { Statement } = shim,
|
|
110
|
-
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
111
|
-
referenceNode = referenceNodeQuery(qualifiedStatementNode),
|
|
112
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
113
|
-
context = localContext, ///
|
|
114
|
-
statement = Statement.fromStatementNode(statementNode, context),
|
|
115
|
-
reference = Reference.fromReferenceNode(referenceNode, context),
|
|
116
|
-
node = qualifiedStatementNode; ///
|
|
117
|
-
|
|
118
|
-
string = fileContext.nodeAsString(node);
|
|
119
|
-
|
|
120
|
-
string = trim(string); ///
|
|
121
|
-
|
|
122
|
-
qualifiedStatement = new QualifiedStatement(string, statement, reference);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return qualifiedStatement;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
Object.assign(shim, {
|
|
130
|
-
QualifiedStatement
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
export default QualifiedStatement;
|