occam-verify-cli 1.0.760 → 1.0.764
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/context/file/nominal.js +2 -3
- package/lib/context/literal.js +1 -1
- package/lib/context/nominal.js +2 -3
- package/lib/element/assertion/contained.js +4 -3
- package/lib/element/assertion/defined.js +4 -3
- package/lib/element/assertion/property.js +5 -4
- package/lib/element/assertion/satisfies.js +4 -3
- package/lib/element/assertion/subproof.js +4 -3
- package/lib/element/assertion/type.js +4 -3
- package/lib/element/combinator.js +2 -3
- package/lib/element/conclusion.js +7 -5
- package/lib/element/constructor.js +2 -3
- package/lib/element/deduction.js +7 -5
- package/lib/element/equality.js +2 -3
- package/lib/element/frame.js +2 -3
- package/lib/element/hypothesis.js +2 -3
- package/lib/element/judgement.js +2 -3
- package/lib/element/label.js +3 -4
- package/lib/element/metavariable.js +11 -26
- package/lib/element/parameter.js +2 -3
- package/lib/element/procedureCall.js +2 -3
- package/lib/element/procedureReference.js +2 -3
- package/lib/element/proofAssertion/premise.js +2 -3
- package/lib/element/proofAssertion/supposition.js +8 -5
- package/lib/element/property.js +2 -3
- package/lib/element/propertyRelation.js +2 -3
- package/lib/element/reference.js +2 -3
- package/lib/element/signature.js +2 -3
- package/lib/element/statement.js +2 -3
- package/lib/element/substitution/frame.js +4 -3
- package/lib/element/substitution/metaLevel.js +3 -4
- package/lib/element/substitution/reference.js +4 -3
- package/lib/element/substitution/statement.js +4 -3
- package/lib/element/substitution/term.js +4 -3
- package/lib/element/term.js +2 -3
- package/lib/element/type.js +2 -3
- package/lib/element/typePrefix.js +2 -3
- package/lib/element/variable.js +5 -10
- package/lib/utilities/context.js +29 -15
- package/lib/utilities/unification.js +4 -9
- package/lib/utilities/validation.js +14 -8
- package/package.json +4 -4
- package/src/context/file/nominal.js +1 -5
- package/src/context/literal.js +1 -1
- package/src/context/nominal.js +1 -5
- package/src/element/assertion/contained.js +4 -2
- package/src/element/assertion/defined.js +4 -2
- package/src/element/assertion/property.js +5 -3
- package/src/element/assertion/satisfies.js +4 -2
- package/src/element/assertion/subproof.js +4 -2
- package/src/element/assertion/type.js +4 -2
- package/src/element/combinator.js +1 -3
- package/src/element/conclusion.js +8 -4
- package/src/element/constructor.js +1 -3
- package/src/element/deduction.js +8 -4
- package/src/element/equality.js +1 -3
- package/src/element/frame.js +1 -3
- package/src/element/hypothesis.js +1 -3
- package/src/element/judgement.js +1 -3
- package/src/element/label.js +2 -4
- package/src/element/metavariable.js +17 -36
- package/src/element/parameter.js +1 -3
- package/src/element/procedureCall.js +1 -3
- package/src/element/procedureReference.js +1 -3
- package/src/element/proofAssertion/premise.js +1 -3
- package/src/element/proofAssertion/supposition.js +8 -4
- package/src/element/property.js +1 -3
- package/src/element/propertyRelation.js +1 -3
- package/src/element/reference.js +1 -3
- package/src/element/signature.js +1 -3
- package/src/element/statement.js +1 -3
- package/src/element/substitution/frame.js +4 -2
- package/src/element/substitution/metaLevel.js +2 -4
- package/src/element/substitution/reference.js +4 -2
- package/src/element/substitution/statement.js +4 -2
- package/src/element/substitution/term.js +4 -2
- package/src/element/term.js +1 -3
- package/src/element/type.js +1 -3
- package/src/element/typePrefix.js +2 -3
- package/src/element/variable.js +5 -12
- package/src/utilities/context.js +42 -17
- package/src/utilities/unification.js +5 -11
- package/src/utilities/validation.js +17 -9
|
@@ -187,7 +187,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
187
187
|
const { name } = json;
|
|
188
188
|
|
|
189
189
|
if (this.name === name) {
|
|
190
|
-
instantiate((context) => {
|
|
190
|
+
termSubstitutionn = instantiate((context) => {
|
|
191
191
|
const { string } = json,
|
|
192
192
|
termSubstitutionNode = instantiateTermSubstitution(string, context),
|
|
193
193
|
node = termSubstitutionNode, ///
|
|
@@ -196,7 +196,9 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
196
196
|
|
|
197
197
|
context = null;
|
|
198
198
|
|
|
199
|
-
termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
|
|
199
|
+
const termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
|
|
200
|
+
|
|
201
|
+
return termSubstitutionn;
|
|
200
202
|
}, context);
|
|
201
203
|
}
|
|
202
204
|
|
package/src/element/term.js
CHANGED
|
@@ -238,7 +238,7 @@ export default define(class Term extends Element {
|
|
|
238
238
|
static name = "Term";
|
|
239
239
|
|
|
240
240
|
static fromJSON(json, context) {
|
|
241
|
-
|
|
241
|
+
return instantiate((context) => {
|
|
242
242
|
const { string } = json,
|
|
243
243
|
termNode = instantiateTerm(string, context),
|
|
244
244
|
node = termNode, ///
|
|
@@ -250,7 +250,5 @@ export default define(class Term extends Element {
|
|
|
250
250
|
|
|
251
251
|
return term;
|
|
252
252
|
}, context);
|
|
253
|
-
|
|
254
|
-
return term;
|
|
255
253
|
}
|
|
256
254
|
});
|
package/src/element/type.js
CHANGED
|
@@ -316,7 +316,7 @@ export default define(class Type extends Element {
|
|
|
316
316
|
static name = "Type";
|
|
317
317
|
|
|
318
318
|
static fromJSON(json, context) {
|
|
319
|
-
|
|
319
|
+
return instantiate((context) => {
|
|
320
320
|
const { string } = json,
|
|
321
321
|
typeNode = instantiateType(string, context),
|
|
322
322
|
node = typeNode, ///
|
|
@@ -332,8 +332,6 @@ export default define(class Type extends Element {
|
|
|
332
332
|
|
|
333
333
|
return type;
|
|
334
334
|
}, context);
|
|
335
|
-
|
|
336
|
-
return type;
|
|
337
335
|
}
|
|
338
336
|
|
|
339
337
|
static fromName(name, context) {
|
|
@@ -43,7 +43,8 @@ export default define(class TypePrefix extends Element {
|
|
|
43
43
|
static name = "TypePrefix";
|
|
44
44
|
|
|
45
45
|
static fromJSON(json, context) {
|
|
46
|
-
|
|
46
|
+
return instantiate((context) => {
|
|
47
|
+
const { string } = json,
|
|
47
48
|
typePrefixNode = instantiateTypePrefix(string, context),
|
|
48
49
|
node = typePrefixNode, ///
|
|
49
50
|
name = nameFromTypePrefixNode(typePrefixNode, context);
|
|
@@ -54,7 +55,5 @@ export default define(class TypePrefix extends Element {
|
|
|
54
55
|
|
|
55
56
|
return typePrefix;
|
|
56
57
|
}, context);
|
|
57
|
-
|
|
58
|
-
return typePrefix;
|
|
59
58
|
}
|
|
60
59
|
});
|
package/src/element/variable.js
CHANGED
|
@@ -153,17 +153,12 @@ export default define(class Variable extends Element {
|
|
|
153
153
|
termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
|
|
154
154
|
|
|
155
155
|
if (termTypeEqualToOrSubTypeOfVariableType) {
|
|
156
|
-
const { TermSubstitution } = elements
|
|
156
|
+
const { TermSubstitution } = elements,
|
|
157
|
+
termSubstitution = TermSubstitution.fromTermAndVariable(term, variable, context);
|
|
157
158
|
|
|
158
|
-
|
|
159
|
+
termSubstitution.validate(generalContext, specificContext);
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
termSubstitution = termSubstitution.validate(generalContext, specificContext); ///
|
|
163
|
-
|
|
164
|
-
if (termSubstitution !== null) {
|
|
165
|
-
termUnifies = true;
|
|
166
|
-
}
|
|
161
|
+
termUnifies = true;
|
|
167
162
|
}
|
|
168
163
|
}
|
|
169
164
|
|
|
@@ -189,7 +184,7 @@ export default define(class Variable extends Element {
|
|
|
189
184
|
static name = "Variable";
|
|
190
185
|
|
|
191
186
|
static fromJSON(json, context) {
|
|
192
|
-
|
|
187
|
+
return instantiate((context) => {
|
|
193
188
|
const { string } = json,
|
|
194
189
|
variableNode = instantiateVariable(string, context),
|
|
195
190
|
node = variableNode, ///
|
|
@@ -202,7 +197,5 @@ export default define(class Variable extends Element {
|
|
|
202
197
|
|
|
203
198
|
return variable;
|
|
204
199
|
}, context);
|
|
205
|
-
|
|
206
|
-
return variable;
|
|
207
200
|
}
|
|
208
201
|
});
|
package/src/utilities/context.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import ScopedContext from "../context/scoped";
|
|
4
|
-
import LiminalContext from "../context/liminal";
|
|
5
|
-
import LiteralContext from "../context/literal";
|
|
6
4
|
import nominalContext from "../context/nominal";
|
|
5
|
+
import LiteralContext from "../context/literal";
|
|
6
|
+
import LiminalContext from "../context/liminal";
|
|
7
7
|
import EphemeralContext from "../context/ephemeral";
|
|
8
8
|
import BranchingContext from "../context/branching";
|
|
9
9
|
import SyntheticContext from "../context/synthetic";
|
|
10
10
|
|
|
11
|
+
export function nominally(innerFunction) {
|
|
12
|
+
let context;
|
|
13
|
+
|
|
14
|
+
context = nominalContext; ///
|
|
15
|
+
|
|
16
|
+
const literalContext = LiteralContext.fromNothing(context);
|
|
17
|
+
|
|
18
|
+
context = literalContext; ///
|
|
19
|
+
|
|
20
|
+
return innerFunction(context);
|
|
21
|
+
}
|
|
22
|
+
|
|
11
23
|
export function join(innerFunction, ...contexts) {
|
|
12
24
|
const syntheticContext = SyntheticContext.fromContexts(...contexts),
|
|
13
25
|
context = syntheticContext; ///
|
|
@@ -39,26 +51,22 @@ export function reconcile(innerFunction, context) {
|
|
|
39
51
|
return innerFunction(context);
|
|
40
52
|
}
|
|
41
53
|
|
|
42
|
-
export function
|
|
43
|
-
let context;
|
|
44
|
-
|
|
45
|
-
context = nominalContext; ///
|
|
46
|
-
|
|
54
|
+
export function instantiate(innerFunction, context) {
|
|
47
55
|
const literalContext = LiteralContext.fromNothing(context);
|
|
48
56
|
|
|
49
57
|
context = literalContext; ///
|
|
50
58
|
|
|
51
|
-
|
|
52
|
-
}
|
|
59
|
+
const element = innerFunction(context);
|
|
53
60
|
|
|
54
|
-
|
|
55
|
-
const literalContext = LiteralContext.fromNothing(context);
|
|
61
|
+
context = element.getContext();
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
if (context !== null) {
|
|
64
|
+
context = context.getContext();
|
|
58
65
|
|
|
59
|
-
|
|
66
|
+
element.setContext(context);
|
|
67
|
+
}
|
|
60
68
|
|
|
61
|
-
return
|
|
69
|
+
return element;
|
|
62
70
|
}
|
|
63
71
|
|
|
64
72
|
export async function asyncRestrict(innerFunction, metaLevelSubstitutions, context) {
|
|
@@ -83,10 +91,27 @@ export async function asyncReconcile(innerFunction, context) {
|
|
|
83
91
|
return await innerFunction(context);
|
|
84
92
|
}
|
|
85
93
|
|
|
86
|
-
function
|
|
87
|
-
let context;
|
|
94
|
+
function sanitisedContextFromContext(context) {
|
|
95
|
+
let contextExtraneousContext = isContextExtraneousContext(context);
|
|
96
|
+
|
|
97
|
+
while (contextExtraneousContext) {
|
|
98
|
+
context = context.getContext();
|
|
88
99
|
|
|
89
|
-
|
|
100
|
+
contextExtraneousContext = isContextExtraneousContext(context);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const ephemeralContext = EphemeralContext.fromNothing(context),
|
|
104
|
+
sanitisedContext = ephemeralContext; ///
|
|
105
|
+
|
|
106
|
+
return sanitisedContext;
|
|
107
|
+
}
|
|
90
108
|
|
|
109
|
+
function isContextExtraneousContext(context) {
|
|
110
|
+
const contextLiminalContext = (context instanceof LiminalContext),
|
|
111
|
+
contextEphemeralContext = (context instanceof EphemeralContext),
|
|
112
|
+
contextBranchingContext = (context instanceof BranchingContext),
|
|
113
|
+
contextSyntheticContext = (context instanceof SyntheticContext),
|
|
114
|
+
contextExtraneousContext = (contextLiminalContext || contextEphemeralContext || contextBranchingContext || contextSyntheticContext);
|
|
91
115
|
|
|
116
|
+
return contextExtraneousContext;
|
|
92
117
|
}
|
|
@@ -62,20 +62,14 @@ async function unifyStatementWithReference(statement, reference, satisfiesAssert
|
|
|
62
62
|
const metaLevelSubstitutions = context.hasMetaLevelSubstitutions();
|
|
63
63
|
|
|
64
64
|
if (metaLevelSubstitutions) {
|
|
65
|
-
const { MetaLevelSubstitution } = elements
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
metaLevelSubstitution = MetaLevelSubstitution.fromStatementAndReference(statement, reference, context);
|
|
70
|
-
|
|
71
|
-
const generalContext = context, ///
|
|
65
|
+
const { MetaLevelSubstitution } = elements,
|
|
66
|
+
metaLevelSubstitution = MetaLevelSubstitution.fromStatementAndReference(statement, reference, context),
|
|
67
|
+
generalContext = context, ///
|
|
72
68
|
specificContext = context; ///
|
|
73
69
|
|
|
74
|
-
metaLevelSubstitution
|
|
70
|
+
metaLevelSubstitution.validate(generalContext, specificContext);
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
statementUnifiesWithReference = true;
|
|
78
|
-
}
|
|
72
|
+
statementUnifiesWithReference = true;
|
|
79
73
|
}
|
|
80
74
|
}
|
|
81
75
|
|
|
@@ -104,20 +104,28 @@ function validateStatementAsMetavariable(statement, stated, context) {
|
|
|
104
104
|
statementValidatesAsMetavariable = true;
|
|
105
105
|
|
|
106
106
|
const { TermSubstitution, FrameSubstitution } = elements,
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
generalContext = context, ///
|
|
108
|
+
specificContext = context; ///
|
|
109
109
|
|
|
110
|
-
let
|
|
110
|
+
let termSubstitution,
|
|
111
|
+
frameSubstitution;
|
|
111
112
|
|
|
112
|
-
|
|
113
|
+
termSubstitution = TermSubstitution.fromStatement(statement, context);
|
|
113
114
|
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
specificContext = context; ///
|
|
115
|
+
if (termSubstitution !== null) {
|
|
116
|
+
termSubstitution = termSubstitution.validate(generalContext, specificContext); ///
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
if (termSubstitution === null) {
|
|
119
|
+
statementValidatesAsMetavariable = false;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
frameSubstitution = FrameSubstitution.fromStatement(statement, context);
|
|
124
|
+
|
|
125
|
+
if (frameSubstitution !== null) {
|
|
126
|
+
frameSubstitution = frameSubstitution.validate(generalContext, specificContext); ///
|
|
119
127
|
|
|
120
|
-
if (
|
|
128
|
+
if (frameSubstitution === null) {
|
|
121
129
|
statementValidatesAsMetavariable = false;
|
|
122
130
|
}
|
|
123
131
|
}
|