occam-verify-cli 1.0.747 → 1.0.757
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/branching.js +56 -0
- package/lib/context/ephemeral.js +10 -1
- package/lib/context/file/nominal.js +5 -10
- package/lib/context/scoped.js +6 -5
- package/lib/context/synthetic.js +7 -3
- package/lib/context.js +9 -1
- package/lib/element/assertion/contained.js +7 -7
- package/lib/element/assertion/defined.js +7 -7
- package/lib/element/assertion/property.js +3 -3
- package/lib/element/assertion/satisfies.js +2 -2
- package/lib/element/assertion/subproof.js +111 -14
- package/lib/element/assertion/type.js +7 -7
- package/lib/element/assumption.js +21 -33
- package/lib/element/combinator.js +4 -4
- package/lib/element/conclusion.js +3 -7
- package/lib/element/constructor/bracketed.js +9 -8
- package/lib/element/constructor.js +9 -5
- package/lib/element/deduction.js +17 -20
- package/lib/element/derivation.js +4 -4
- package/lib/element/equality.js +12 -11
- package/lib/element/equivalence.js +3 -3
- package/lib/element/frame.js +2 -2
- package/lib/element/hypothesis.js +2 -2
- package/lib/element/judgement.js +2 -2
- package/lib/element/label.js +4 -4
- package/lib/element/metavariable.js +65 -25
- package/lib/element/parameter.js +2 -2
- package/lib/element/procedureCall.js +2 -2
- package/lib/element/procedureReference.js +2 -2
- package/lib/element/proof.js +7 -7
- package/lib/element/proofAssertion/premise.js +12 -18
- package/lib/element/proofAssertion/step.js +3 -3
- package/lib/element/proofAssertion/supposition.js +13 -19
- package/lib/element/property.js +2 -2
- package/lib/element/propertyRelation.js +3 -3
- package/lib/element/reference.js +11 -9
- package/lib/element/rule.js +2 -2
- package/lib/element/signature.js +3 -3
- package/lib/element/statement.js +100 -59
- package/lib/element/subDerivation.js +4 -4
- package/lib/element/subproof.js +7 -7
- package/lib/element/substitution/frame.js +8 -8
- package/lib/element/substitution/metaLevel.js +7 -7
- package/lib/element/substitution/reference.js +7 -7
- package/lib/element/substitution/statement.js +73 -60
- package/lib/element/substitution/term.js +10 -10
- package/lib/element/term.js +17 -14
- package/lib/element/topLevelAssertion/axiom.js +15 -13
- package/lib/element/topLevelAssertion.js +2 -5
- package/lib/element/topLevelMetaAssertion.js +27 -3
- package/lib/element/type.js +2 -2
- package/lib/element/typePrefix.js +2 -2
- package/lib/element/variable.js +6 -3
- package/lib/process/unify.js +51 -9
- package/lib/process/validate.js +5 -5
- package/lib/utilities/context.js +28 -20
- package/lib/utilities/element.js +2 -2
- package/lib/utilities/instance.js +3 -3
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/string.js +2 -2
- package/lib/utilities/validation.js +13 -5
- package/package.json +3 -3
- package/src/context/branching.js +59 -0
- package/src/context/ephemeral.js +12 -0
- package/src/context/file/nominal.js +4 -12
- package/src/context/scoped.js +6 -4
- package/src/context/synthetic.js +9 -2
- package/src/context.js +14 -0
- package/src/element/assertion/contained.js +8 -8
- package/src/element/assertion/defined.js +7 -7
- package/src/element/assertion/property.js +4 -4
- package/src/element/assertion/satisfies.js +2 -2
- package/src/element/assertion/subproof.js +191 -18
- package/src/element/assertion/type.js +7 -7
- package/src/element/assumption.js +21 -52
- package/src/element/combinator.js +4 -4
- package/src/element/conclusion.js +3 -10
- package/src/element/constructor/bracketed.js +9 -7
- package/src/element/constructor.js +11 -5
- package/src/element/deduction.js +17 -23
- package/src/element/derivation.js +4 -3
- package/src/element/equality.js +16 -14
- package/src/element/equivalence.js +3 -3
- package/src/element/frame.js +2 -2
- package/src/element/hypothesis.js +2 -2
- package/src/element/judgement.js +2 -2
- package/src/element/label.js +4 -4
- package/src/element/metavariable.js +96 -32
- package/src/element/parameter.js +2 -2
- package/src/element/procedureCall.js +2 -2
- package/src/element/procedureReference.js +2 -2
- package/src/element/proof.js +8 -8
- package/src/element/proofAssertion/premise.js +22 -32
- package/src/element/proofAssertion/step.js +3 -3
- package/src/element/proofAssertion/supposition.js +27 -36
- package/src/element/property.js +2 -2
- package/src/element/propertyRelation.js +3 -3
- package/src/element/reference.js +11 -9
- package/src/element/rule.js +2 -2
- package/src/element/signature.js +3 -3
- package/src/element/statement.js +154 -88
- package/src/element/subDerivation.js +4 -3
- package/src/element/subproof.js +6 -6
- package/src/element/substitution/frame.js +8 -8
- package/src/element/substitution/metaLevel.js +7 -7
- package/src/element/substitution/reference.js +7 -7
- package/src/element/substitution/statement.js +99 -76
- package/src/element/substitution/term.js +10 -10
- package/src/element/term.js +22 -16
- package/src/element/topLevelAssertion/axiom.js +20 -16
- package/src/element/topLevelAssertion.js +2 -4
- package/src/element/topLevelMetaAssertion.js +42 -3
- package/src/element/type.js +3 -2
- package/src/element/typePrefix.js +2 -2
- package/src/element/variable.js +12 -3
- package/src/process/unify.js +78 -9
- package/src/process/validate.js +4 -4
- package/src/utilities/context.js +20 -12
- package/src/utilities/element.js +2 -2
- package/src/utilities/instance.js +3 -3
- package/src/utilities/releaseContext.js +1 -1
- package/src/utilities/string.js +3 -3
- package/src/utilities/validation.js +16 -4
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateContainedAssertion } from "../../process/instantiate";
|
|
8
8
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
|
|
9
9
|
import { termFromContainedAssertionNode, frameFromContainedAssertionNode, negatedFromContainedAssertionNode, statementFromContainedAssertionNode } from "../../utilities/element";
|
|
@@ -97,14 +97,14 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
97
97
|
const termString = this.term.getString(),
|
|
98
98
|
containedAssertionString = this.getString(); ///
|
|
99
99
|
|
|
100
|
-
context.trace(`Validating the '${containedAssertionString}' contained
|
|
100
|
+
context.trace(`Validating the '${containedAssertionString}' contained assertion's '${termString}' term...`);
|
|
101
101
|
|
|
102
102
|
const termSingular = this.term.isSingular();
|
|
103
103
|
|
|
104
104
|
if (!termSingular) {
|
|
105
105
|
context.debug(`The '${termString}' term is not singular.`);
|
|
106
106
|
} else {
|
|
107
|
-
const term = this.term.validate(context, () => {
|
|
107
|
+
const term = this.term.validate(context, (term) => {
|
|
108
108
|
const validatesForwards = true;
|
|
109
109
|
|
|
110
110
|
return validatesForwards;
|
|
@@ -117,7 +117,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
if (termValidates) {
|
|
120
|
-
context.debug(`...validated the '${containedAssertionString}' contained
|
|
120
|
+
context.debug(`...validated the '${containedAssertionString}' contained assertion's '${termString}' term.`);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -132,7 +132,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
132
132
|
const frameString = this.frame.getString(),
|
|
133
133
|
containedAssertionString = this.getString(); ///
|
|
134
134
|
|
|
135
|
-
context.trace(`Validating the '${containedAssertionString}' contained
|
|
135
|
+
context.trace(`Validating the '${containedAssertionString}' contained assertion's '${frameString}' frame...`);
|
|
136
136
|
|
|
137
137
|
const frameSingular = this.frame.isSingular();
|
|
138
138
|
|
|
@@ -151,7 +151,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
if (frameValidates) {
|
|
154
|
-
context.debug(`...validated the '${containedAssertionString}' contained
|
|
154
|
+
context.debug(`...validated the '${containedAssertionString}' contained assertion's '${frameString}' frame.`);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -206,7 +206,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
206
206
|
context.trace(`Validating the '${containedAssertionString}' derived contained assertion...`);
|
|
207
207
|
|
|
208
208
|
const generalCotnext = null,
|
|
209
|
-
specificContext = context;
|
|
209
|
+
specificContext = context; ///
|
|
210
210
|
|
|
211
211
|
validatesWhenDerived = validateWhenDerived(this.term, this.frame, this.statement, this.negated, generalCotnext, specificContext);
|
|
212
212
|
|
|
@@ -247,7 +247,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
247
247
|
const { name } = json;
|
|
248
248
|
|
|
249
249
|
if (this.name === name) {
|
|
250
|
-
|
|
250
|
+
instantiate((context) => {
|
|
251
251
|
const { string } = json,
|
|
252
252
|
containedAssertionNode = instantiateContainedAssertion(string, context),
|
|
253
253
|
node = containedAssertionNode, ///
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateDefinedAssertion } from "../../process/instantiate";
|
|
8
8
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
|
|
9
9
|
import { termFromJDefinedAssertionNode, frameFromJDefinedAssertionNode, negatedFromJDefinedAssertionNode } from "../../utilities/element";
|
|
@@ -91,14 +91,14 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
91
91
|
const termString = this.term.getString(), ///
|
|
92
92
|
definedAssertionString = this.getString(); ///
|
|
93
93
|
|
|
94
|
-
context.trace(`Validating the '${definedAssertionString}' defined
|
|
94
|
+
context.trace(`Validating the '${definedAssertionString}' defined assertion's '${termString}' term...`);
|
|
95
95
|
|
|
96
96
|
const termSingular = this.term.isSingular();
|
|
97
97
|
|
|
98
98
|
if (!termSingular) {
|
|
99
99
|
context.debug(`The '${termString}' term is not singular.`);
|
|
100
100
|
} else {
|
|
101
|
-
const term = this.term.validate(context, () => {
|
|
101
|
+
const term = this.term.validate(context, (term) => {
|
|
102
102
|
const validatesForwards = true;
|
|
103
103
|
|
|
104
104
|
return validatesForwards;
|
|
@@ -111,7 +111,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
if (termValidates) {
|
|
114
|
-
context.debug(`...validates the'${definedAssertionString}' defined
|
|
114
|
+
context.debug(`...validates the'${definedAssertionString}' defined assertion's '${termString}' term.`);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -126,7 +126,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
126
126
|
const frameString = this.frame.getString(), ///
|
|
127
127
|
definedAssertionString = this.getString(); ///
|
|
128
128
|
|
|
129
|
-
context.trace(`Validating the'${definedAssertionString}' defined
|
|
129
|
+
context.trace(`Validating the'${definedAssertionString}' defined assertion's '${frameString}' frame...`);
|
|
130
130
|
|
|
131
131
|
const frameSingular = this.frame.isSingular();
|
|
132
132
|
|
|
@@ -144,7 +144,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
if (frameValidates) {
|
|
147
|
-
context.debug(`...validates the'${definedAssertionString}' defined
|
|
147
|
+
context.debug(`...validates the'${definedAssertionString}' defined assertion's '${frameString}' frame.`);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|
|
@@ -216,7 +216,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
216
216
|
const { name } = json;
|
|
217
217
|
|
|
218
218
|
if (this.name === name) {
|
|
219
|
-
|
|
219
|
+
instantiate((context) => {
|
|
220
220
|
const { string } = json,
|
|
221
221
|
definedAssertionNode = instantiateDefinedAssertion(string, context),
|
|
222
222
|
node = definedAssertionNode, ///
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiatePropertyAssertion } from "../../process/instantiate";
|
|
8
8
|
import { variableAssignmentFromPrepertyAssertion } from "../../process/assign";
|
|
9
9
|
import { termFromPropertyAssertionNode, propertyRelationFromPropertyAssertionNode } from "../../utilities/element";
|
|
@@ -117,13 +117,13 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
117
117
|
|
|
118
118
|
context.trace(`Validating the '${termString}' term...`);
|
|
119
119
|
|
|
120
|
-
const term = this.term.validate(context, () => {
|
|
120
|
+
const term = this.term.validate(context, (term) => {
|
|
121
121
|
const validatesForwards = true;
|
|
122
122
|
|
|
123
123
|
return validatesForwards;
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
if (
|
|
126
|
+
if (term !== null) {
|
|
127
127
|
this.term = term;
|
|
128
128
|
|
|
129
129
|
termValidates = true;
|
|
@@ -208,7 +208,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
208
208
|
const { name } = json;
|
|
209
209
|
|
|
210
210
|
if (this.name === name) {
|
|
211
|
-
|
|
211
|
+
instantiate((context) => {
|
|
212
212
|
const { string } = json,
|
|
213
213
|
propertyAssertionNode = instantiatePropertyAssertion(string, context),
|
|
214
214
|
node = propertyAssertionNode, ///
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateSatisfiesAssertion } from "../../process/instantiate";
|
|
8
8
|
import { signatureFromJSatisfiesAssertionNode, referenceFromJSatisfiesAssertionNode } from "../../utilities/element";
|
|
9
9
|
|
|
@@ -165,7 +165,7 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
165
165
|
const { name } = json;
|
|
166
166
|
|
|
167
167
|
if (this.name === name) {
|
|
168
|
-
|
|
168
|
+
instantiate((context) => {const { string } = json,
|
|
169
169
|
definedAssertionNode = instantiateSatisfiesAssertion(string, context),
|
|
170
170
|
node = definedAssertionNode, ///
|
|
171
171
|
signature = signatureFromJSatisfiesAssertionNode(definedAssertionNode, context),
|
|
@@ -5,11 +5,11 @@ import { arrayUtilities } from "necessary";
|
|
|
5
5
|
import Assertion from "../assertion";
|
|
6
6
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { reconcile } from "../../utilities/context";
|
|
9
|
+
import { instantiate } from "../../utilities/context";
|
|
10
10
|
import { instantiateSubproofAssertion } from "../../process/instantiate";
|
|
11
11
|
|
|
12
|
-
const {
|
|
12
|
+
const { last, front, backwardsEvery } = arrayUtilities;
|
|
13
13
|
|
|
14
14
|
export default define(class SubproofAssertion extends Assertion {
|
|
15
15
|
constructor(context, string, node, statements) {
|
|
@@ -22,6 +22,26 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
22
22
|
return this.statements;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
getLastStatement() {
|
|
26
|
+
const lastStatement = last(this.statements);
|
|
27
|
+
|
|
28
|
+
return lastStatement;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getSupposedStatement(index) {
|
|
32
|
+
const statement = this.statements[index],
|
|
33
|
+
supposedStatement = statement; ///
|
|
34
|
+
|
|
35
|
+
return supposedStatement;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getSupposedStatements() {
|
|
39
|
+
const frontStatements = front(this.statements),
|
|
40
|
+
supposedStatements = frontStatements; ///
|
|
41
|
+
|
|
42
|
+
return supposedStatements;
|
|
43
|
+
}
|
|
44
|
+
|
|
25
45
|
getSubproofAssertionNode() {
|
|
26
46
|
const node = this.getNode(),
|
|
27
47
|
subproofAssertionNode = node; ///
|
|
@@ -86,33 +106,186 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
86
106
|
}
|
|
87
107
|
|
|
88
108
|
unifySubproof(subproof, generalContext, specificContext) {
|
|
89
|
-
let subproofUnifies;
|
|
109
|
+
let subproofUnifies = false;
|
|
90
110
|
|
|
91
|
-
const
|
|
92
|
-
|
|
111
|
+
const context = specificContext, ///
|
|
112
|
+
subproofString = subproof.getString(),
|
|
113
|
+
subproofAssertionString = this.getString(); ///
|
|
93
114
|
|
|
94
|
-
|
|
115
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
|
|
95
116
|
|
|
96
|
-
const
|
|
97
|
-
|
|
117
|
+
const lastStep = subproof.getLastStep(),
|
|
118
|
+
lastStepUnifies = this.unifyLastStep(lastStep, generalContext, specificContext);
|
|
98
119
|
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
statementUnifies = unifyStatement(generalStatement, specificStatement, generalContext, specificContext);
|
|
120
|
+
if (lastStepUnifies) {
|
|
121
|
+
const suppositions = subproof.getSuppositions(),
|
|
122
|
+
suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
|
|
103
123
|
|
|
104
|
-
if (
|
|
105
|
-
|
|
124
|
+
if (suppositionsUnify) {
|
|
125
|
+
subproofUnifies = true;
|
|
106
126
|
}
|
|
107
|
-
}
|
|
127
|
+
}
|
|
108
128
|
|
|
109
129
|
if (subproofUnifies) {
|
|
110
|
-
|
|
130
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
|
|
111
131
|
}
|
|
112
132
|
|
|
113
133
|
return subproofUnifies;
|
|
114
134
|
}
|
|
115
135
|
|
|
136
|
+
unifyLastStep(lastStep, generalContext, specificContext) {
|
|
137
|
+
let lastStepUnifies = false;
|
|
138
|
+
|
|
139
|
+
const lastStatement = this.getLastStatement(),
|
|
140
|
+
lastStepString = lastStep.getString(),
|
|
141
|
+
lastStepStatement = lastStep.getStatement(),
|
|
142
|
+
lastStatementString = lastStatement.getString(),
|
|
143
|
+
subproofAssertionString = this.getString(), ///
|
|
144
|
+
lastStepStatementString = lastStepStatement.getString();
|
|
145
|
+
|
|
146
|
+
let context;
|
|
147
|
+
|
|
148
|
+
context = specificContext; ///
|
|
149
|
+
|
|
150
|
+
context.trace(`Unifying the '${lastStepString}' last step's '${lastStepStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement...`)
|
|
151
|
+
|
|
152
|
+
context = lastStep.getContext();
|
|
153
|
+
|
|
154
|
+
specificContext = context; ///
|
|
155
|
+
|
|
156
|
+
reconcile((specificContext) => {
|
|
157
|
+
const lastStepStatementUnifies = lastStatement.unifyStatement(lastStepStatement, generalContext, specificContext);
|
|
158
|
+
|
|
159
|
+
if (lastStepStatementUnifies) {
|
|
160
|
+
lastStepUnifies = true;
|
|
161
|
+
}
|
|
162
|
+
}, specificContext);
|
|
163
|
+
|
|
164
|
+
if (lastStepUnifies) {
|
|
165
|
+
context.debug(`...unified the '${lastStepString}' last step's '${lastStepStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement.`)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return lastStepUnifies;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
unifyDeduction(deduction, generalContext, specificContext) {
|
|
172
|
+
let deductionUnifies = false;
|
|
173
|
+
|
|
174
|
+
const lastStatement = this.getLastStatement(),
|
|
175
|
+
deductionString = deduction.getString(),
|
|
176
|
+
deductionStatement = deduction.getStatement(),
|
|
177
|
+
lastStatementString = lastStatement.getString(),
|
|
178
|
+
subproofAssertionString = this.getString(), ///
|
|
179
|
+
deductionStatementString = deductionStatement.getString();
|
|
180
|
+
|
|
181
|
+
let context;
|
|
182
|
+
|
|
183
|
+
context = specificContext; ///
|
|
184
|
+
|
|
185
|
+
context.trace(`Unifying the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement...`)
|
|
186
|
+
|
|
187
|
+
context = deduction.getContext();
|
|
188
|
+
|
|
189
|
+
specificContext = context; ///
|
|
190
|
+
|
|
191
|
+
reconcile((specificContext) => {
|
|
192
|
+
const deductionStatementUnifies = lastStatement.unifyStatement(deductionStatement, generalContext, specificContext);
|
|
193
|
+
|
|
194
|
+
if (deductionStatementUnifies) {
|
|
195
|
+
deductionUnifies = true;
|
|
196
|
+
}
|
|
197
|
+
}, specificContext);
|
|
198
|
+
|
|
199
|
+
if (deductionUnifies) {
|
|
200
|
+
context.debug(`...unified the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement.`)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return deductionUnifies;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
unifySupposition(supposition, index, generalContext, specificContext) {
|
|
207
|
+
let suppositionUnifies = false;
|
|
208
|
+
|
|
209
|
+
const supposedStatement = this.getSupposedStatement(index),
|
|
210
|
+
suppositionString = supposition.getString(),
|
|
211
|
+
suppositionStatement = supposition.getStatement(),
|
|
212
|
+
subproofAssertionString = this.getString(), ///
|
|
213
|
+
supposedStatementString = supposedStatement.getString(),
|
|
214
|
+
suppositionStatementString = suppositionStatement.getString(); ///
|
|
215
|
+
|
|
216
|
+
let context;
|
|
217
|
+
|
|
218
|
+
context = specificContext; ///
|
|
219
|
+
|
|
220
|
+
context.trace(`Unifying the '${suppositionString}' supposition's '${suppositionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${supposedStatementString}' supposed statement...`)
|
|
221
|
+
|
|
222
|
+
context = supposition.getContext();
|
|
223
|
+
|
|
224
|
+
specificContext = context; ///
|
|
225
|
+
|
|
226
|
+
reconcile((specificContext) => {
|
|
227
|
+
const suppositionStatementUnifies = supposedStatement.unifyStatement(suppositionStatement, generalContext, specificContext);
|
|
228
|
+
|
|
229
|
+
if (suppositionStatementUnifies) {
|
|
230
|
+
suppositionUnifies = true;
|
|
231
|
+
}
|
|
232
|
+
}, specificContext);
|
|
233
|
+
|
|
234
|
+
if (suppositionUnifies) {
|
|
235
|
+
context.debug(`...unified the '${suppositionString}' supposition's '${suppositionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${supposedStatementString}' supposed statement.`)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return suppositionUnifies;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
unifySuppositions(suppositions, generalContext, specificContext) {
|
|
242
|
+
let suppositionsUnify = false;
|
|
243
|
+
|
|
244
|
+
const supposedStatements = this.getSupposedStatements(),
|
|
245
|
+
suppositionsLength = suppositions.length,
|
|
246
|
+
supposedStatementsLength = supposedStatements.length;
|
|
247
|
+
|
|
248
|
+
if (suppositionsLength === supposedStatementsLength) {
|
|
249
|
+
suppositionsUnify = backwardsEvery(suppositions, (supposition, index) => {
|
|
250
|
+
const suppositionUnifies = this.unifySupposition(supposition, index, generalContext, specificContext);
|
|
251
|
+
|
|
252
|
+
if (suppositionUnifies) {
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return suppositionsUnify;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext) {
|
|
262
|
+
let topLevelMetaAssertionUnifies = false;
|
|
263
|
+
|
|
264
|
+
const context = specificContext, ///
|
|
265
|
+
subproofAssertionString = this.getString(), ///
|
|
266
|
+
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
267
|
+
|
|
268
|
+
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion...`);
|
|
269
|
+
|
|
270
|
+
const deduction = topLevelMetaAssertion.getDeduction(),
|
|
271
|
+
deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
|
|
272
|
+
|
|
273
|
+
if (deductionUnifies) {
|
|
274
|
+
const suppositions = topLevelMetaAssertion.getSuppositions(),
|
|
275
|
+
suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
|
|
276
|
+
|
|
277
|
+
if (suppositionsUnify) {
|
|
278
|
+
topLevelMetaAssertionUnifies = true;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (topLevelMetaAssertionUnifies) {
|
|
283
|
+
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion.`);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return topLevelMetaAssertionUnifies;
|
|
287
|
+
}
|
|
288
|
+
|
|
116
289
|
static name = "SubproofAssertion";
|
|
117
290
|
|
|
118
291
|
static fromJSON(json, context) {
|
|
@@ -121,7 +294,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
121
294
|
const { name } = json;
|
|
122
295
|
|
|
123
296
|
if (this.name === name) {
|
|
124
|
-
|
|
297
|
+
instantiate((context) => {
|
|
125
298
|
const { string } = json,
|
|
126
299
|
subproofAssertionNode = instantiateSubproofAssertion(string, context),
|
|
127
300
|
statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateTypeAssertion } from "../../process/instantiate";
|
|
8
8
|
import { termFromTypeAssertionNode } from "../../utilities/element";
|
|
9
9
|
import { typeFromJSON, typeToTypeJSON } from "../../utilities/json";
|
|
@@ -114,10 +114,10 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
114
114
|
|
|
115
115
|
context.trace(`Validating the '${typeAssertionString}' stated type assertion...`);
|
|
116
116
|
|
|
117
|
-
const term = this.term.validate(context, () => {
|
|
118
|
-
let validatesForwards;
|
|
117
|
+
const term = this.term.validate(context, (term) => {
|
|
118
|
+
let validatesForwards = false;
|
|
119
119
|
|
|
120
|
-
const termType =
|
|
120
|
+
const termType = term.getType(),
|
|
121
121
|
typeEqualToOrSubTypeOfTermType = this.type.isEqualToOrSubTypeOf(termType);
|
|
122
122
|
|
|
123
123
|
if (typeEqualToOrSubTypeOfTermType) {
|
|
@@ -147,10 +147,10 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
147
147
|
|
|
148
148
|
context.trace(`Validating the '${typeAssertionString}' derived type assertion...`);
|
|
149
149
|
|
|
150
|
-
const term = this.term.validate(context, () => {
|
|
150
|
+
const term = this.term.validate(context, (term) => {
|
|
151
151
|
let validatesForwards = false;
|
|
152
152
|
|
|
153
|
-
const termType =
|
|
153
|
+
const termType = term.getType(),
|
|
154
154
|
termTypeProvisional = termType.isProvisional();
|
|
155
155
|
|
|
156
156
|
if (!termTypeProvisional) {
|
|
@@ -214,7 +214,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
214
214
|
const { name } = json;
|
|
215
215
|
|
|
216
216
|
if (this.name === name) {
|
|
217
|
-
|
|
217
|
+
instantiate((context) => {
|
|
218
218
|
const { string } = json,
|
|
219
219
|
typeAssertionNode = instantiateTypeAssertion(string, context),
|
|
220
220
|
term = termFromTypeAssertionNode(typeAssertionNode, context),
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import { literally } from "../utilities/context";
|
|
7
6
|
import { instantiateAssumption } from "../process/instantiate";
|
|
8
|
-
import {
|
|
7
|
+
import { instantiate, reconcile } from "../utilities/context";
|
|
9
8
|
|
|
10
9
|
export default define(class Assumption extends Element {
|
|
11
10
|
constructor(context, string, node, reference, statement) {
|
|
12
11
|
super(context, string, node);
|
|
13
12
|
|
|
14
|
-
this.statement = statement;
|
|
15
13
|
this.reference = reference;
|
|
14
|
+
this.statement = statement;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
getReference() {
|
|
@@ -166,7 +165,7 @@ export default define(class Assumption extends Element {
|
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
validateWhenStated(context) {
|
|
169
|
-
let validatesWhenStated;
|
|
168
|
+
let validatesWhenStated = false;
|
|
170
169
|
|
|
171
170
|
const assumptionString = this.getString(); ///
|
|
172
171
|
|
|
@@ -179,15 +178,17 @@ export default define(class Assumption extends Element {
|
|
|
179
178
|
validatesWhenStated = true;
|
|
180
179
|
} else {
|
|
181
180
|
const topLevelMetaAssertions = context.findTopLevelMetaAssertionsByReference(this.reference),
|
|
182
|
-
|
|
183
|
-
const
|
|
181
|
+
topLevelMetaAssertionsCompare = topLevelMetaAssertions.some((topLevelMetaAssertion) => {
|
|
182
|
+
const topLevelMetaAssertionCompares = this.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
184
183
|
|
|
185
|
-
if (
|
|
184
|
+
if (topLevelMetaAssertionCompares) {
|
|
186
185
|
return true;
|
|
187
186
|
}
|
|
188
187
|
});
|
|
189
188
|
|
|
190
|
-
|
|
189
|
+
if (topLevelMetaAssertionsCompare) {
|
|
190
|
+
validatesWhenStated = true;
|
|
191
|
+
}
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
if (validatesWhenStated) {
|
|
@@ -198,7 +199,7 @@ export default define(class Assumption extends Element {
|
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
validateWhenDerived(context) {
|
|
201
|
-
let validatesWhenDerived;
|
|
202
|
+
let validatesWhenDerived = false;
|
|
202
203
|
|
|
203
204
|
const assumptionString = this.getString(); ///
|
|
204
205
|
|
|
@@ -206,7 +207,9 @@ export default define(class Assumption extends Element {
|
|
|
206
207
|
|
|
207
208
|
const topLevelMetaAssertionPresent = context.isTopLevelMetaAssertionPresentByReference(this.reference);
|
|
208
209
|
|
|
209
|
-
|
|
210
|
+
if (topLevelMetaAssertionPresent) {
|
|
211
|
+
validatesWhenDerived = true;
|
|
212
|
+
}
|
|
210
213
|
|
|
211
214
|
if (validatesWhenDerived) {
|
|
212
215
|
context.debug(`...validated the '${assumptionString}' derived assumption.`);
|
|
@@ -215,28 +218,6 @@ export default define(class Assumption extends Element {
|
|
|
215
218
|
return validatesWhenDerived;
|
|
216
219
|
}
|
|
217
220
|
|
|
218
|
-
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
219
|
-
let statementUnifies;
|
|
220
|
-
|
|
221
|
-
const context = generalContext, ///
|
|
222
|
-
statementString = statement.getString(),
|
|
223
|
-
assumptionStatementString = this.statement.getString();
|
|
224
|
-
|
|
225
|
-
context.trace(`Unifying the '${statementString}' statement with the '${assumptionStatementString}' statement...`);
|
|
226
|
-
|
|
227
|
-
const generalStatement = this.statement,
|
|
228
|
-
specificStatement = statement, ///
|
|
229
|
-
statementUUnifiesIntrinsically = unifyStatementIntrinsically(generalStatement, specificStatement, substitutions, generalContext, specificContext);
|
|
230
|
-
|
|
231
|
-
statementUnifies = statementUUnifiesIntrinsically; ///
|
|
232
|
-
|
|
233
|
-
if (statementUnifies) {
|
|
234
|
-
context.debug(`...unified the '${statementString}' statement with the '${assumptionStatementString}' statement.`);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return statementUnifies;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
221
|
unifyLabel(label, generalContext, specificContext) {
|
|
241
222
|
let labelUnifiesWithReference;
|
|
242
223
|
|
|
@@ -269,30 +250,18 @@ export default define(class Assumption extends Element {
|
|
|
269
250
|
|
|
270
251
|
context = topLevelMetaAssertion.getContext(); ///
|
|
271
252
|
|
|
272
|
-
const specificContext = context
|
|
273
|
-
labelSubstitutions = [],
|
|
274
|
-
label = topLevelMetaAssertion.getLabel(),
|
|
275
|
-
substitutions = labelSubstitutions, ///
|
|
276
|
-
labelUnifies = this.unifyLabel(label, substitutions, generalContext, specificContext);
|
|
253
|
+
const specificContext = context; ///
|
|
277
254
|
|
|
278
|
-
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
substitutions = statementSubstitutions, ///
|
|
282
|
-
statementUUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
255
|
+
reconcile((specificContext) => {
|
|
256
|
+
const label = topLevelMetaAssertion.getLabel(),
|
|
257
|
+
labelUnifies = this.unifyLabel(label, generalContext, specificContext);
|
|
283
258
|
|
|
284
|
-
if (
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if (labelSubstitutionsCorrelateStatementSubstitutions) {
|
|
288
|
-
topLevelMetaAssertionUnifies = true; ///
|
|
289
|
-
}
|
|
259
|
+
if (labelUnifies) {
|
|
260
|
+
topLevelMetaAssertionUnifies = this.statement.unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext);
|
|
290
261
|
}
|
|
291
|
-
}
|
|
262
|
+
}, specificContext);
|
|
292
263
|
|
|
293
264
|
if (topLevelMetaAssertionUnifies) {
|
|
294
|
-
context = generalContext; ///
|
|
295
|
-
|
|
296
265
|
context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${assumptionString}' assumption...`);
|
|
297
266
|
}
|
|
298
267
|
|
|
@@ -311,7 +280,7 @@ export default define(class Assumption extends Element {
|
|
|
311
280
|
static name = "Assumption";
|
|
312
281
|
|
|
313
282
|
static fromJSON(json, context) {
|
|
314
|
-
const assumption =
|
|
283
|
+
const assumption = instantiate((context) => {
|
|
315
284
|
const { string } = json,
|
|
316
285
|
assumptionNode = instantiateAssumption(string, context),
|
|
317
286
|
node = assumptionNode, ///
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import { attempt,
|
|
6
|
+
import { attempt, instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiateCombinator } from "../process/instantiate";
|
|
8
8
|
import { statementFromCombinatorNode } from "../utilities/element";
|
|
9
9
|
import { unifyStatementWithCombinator } from "../process/unify";
|
|
@@ -21,7 +21,7 @@ export default define(class Combinator extends Element {
|
|
|
21
21
|
return this.statement;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
getCombinatoryNode() {
|
|
25
25
|
const node = this.getNode(),
|
|
26
26
|
combinatorNode = node; ///
|
|
27
27
|
|
|
@@ -39,7 +39,7 @@ export default define(class Combinator extends Element {
|
|
|
39
39
|
const statementValidates = this.validateStatement(context);
|
|
40
40
|
|
|
41
41
|
if (statementValidates) {
|
|
42
|
-
|
|
42
|
+
context.commit(this);
|
|
43
43
|
|
|
44
44
|
validates = true;
|
|
45
45
|
}
|
|
@@ -128,7 +128,7 @@ export default define(class Combinator extends Element {
|
|
|
128
128
|
|
|
129
129
|
context = ephemeralContext; ///
|
|
130
130
|
|
|
131
|
-
const combinator =
|
|
131
|
+
const combinator = instantiate((context) => {
|
|
132
132
|
const { string } = json,
|
|
133
133
|
combinatorNode = instantiateCombinator(string, context),
|
|
134
134
|
node = combinatorNode, ///
|