occam-verify-cli 1.0.617 → 1.0.631
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/ephemeral.js +152 -47
- package/lib/context/file/nominal.js +136 -140
- package/lib/context/liminal.js +16 -26
- package/lib/context/scoped.js +26 -55
- package/lib/context.js +103 -53
- package/lib/element/assertion/contained.js +3 -1
- package/lib/element/assertion/defined.js +3 -1
- package/lib/element/assertion/property.js +10 -58
- package/lib/element/assertion/satisfies.js +3 -1
- package/lib/element/assertion/subproof.js +3 -1
- package/lib/element/assertion/type.js +63 -109
- package/lib/element/assumption.js +40 -16
- package/lib/element/derivation.js +8 -10
- package/lib/element/equality.js +102 -62
- package/lib/element/equivalence.js +6 -6
- package/lib/element/equivalences.js +4 -4
- package/lib/element/frame.js +21 -21
- package/lib/element/hypothesis.js +5 -7
- package/lib/element/judgement.js +47 -25
- package/lib/element/metaType.js +2 -2
- package/lib/element/metavariable.js +12 -3
- package/lib/element/reference.js +9 -21
- package/lib/element/rule.js +13 -15
- package/lib/element/statement.js +23 -25
- package/lib/element/subDerivation.js +4 -6
- package/lib/element/substitution/frame.js +4 -4
- package/lib/element/substitution/reference.js +4 -4
- package/lib/element/substitution/statement.js +4 -4
- package/lib/element/substitution/term.js +7 -1
- package/lib/element/substitution.js +71 -43
- package/lib/element/term.js +15 -1
- package/lib/element/topLevelAssertion.js +9 -11
- package/lib/element/topLevelMetaAssertion.js +9 -11
- package/lib/element/variable.js +44 -3
- package/lib/process/assign.js +96 -26
- package/lib/process/unify.js +3 -4
- package/lib/process/validate.js +2 -2
- package/lib/process/verify.js +2 -2
- package/lib/utilities/element.js +74 -12
- package/lib/utilities/json.js +2 -2
- package/lib/utilities/string.js +9 -24
- package/lib/utilities/substitutions.js +14 -22
- package/package.json +1 -1
- package/src/context/ephemeral.js +170 -50
- package/src/context/file/nominal.js +136 -141
- package/src/context/liminal.js +22 -34
- package/src/context/scoped.js +33 -74
- package/src/context.js +97 -46
- package/src/element/assertion/contained.js +4 -0
- package/src/element/assertion/defined.js +4 -0
- package/src/element/assertion/property.js +15 -26
- package/src/element/assertion/satisfies.js +4 -0
- package/src/element/assertion/subproof.js +4 -0
- package/src/element/assertion/type.js +67 -77
- package/src/element/assumption.js +48 -16
- package/src/element/derivation.js +3 -5
- package/src/element/equality.js +109 -74
- package/src/element/equivalence.js +7 -7
- package/src/element/equivalences.js +7 -5
- package/src/element/frame.js +25 -25
- package/src/element/hypothesis.js +4 -6
- package/src/element/judgement.js +54 -24
- package/src/element/metaType.js +1 -1
- package/src/element/metavariable.js +16 -3
- package/src/element/reference.js +12 -26
- package/src/element/rule.js +8 -10
- package/src/element/statement.js +27 -30
- package/src/element/subDerivation.js +3 -5
- package/src/element/substitution/frame.js +1 -1
- package/src/element/substitution/reference.js +1 -1
- package/src/element/substitution/statement.js +1 -1
- package/src/element/substitution/term.js +2 -0
- package/src/element/substitution.js +60 -36
- package/src/element/term.js +20 -2
- package/src/element/topLevelAssertion.js +4 -6
- package/src/element/topLevelMetaAssertion.js +4 -6
- package/src/element/variable.js +2 -0
- package/src/process/assign.js +114 -37
- package/src/process/unify.js +2 -3
- package/src/process/validate.js +1 -1
- package/src/process/verify.js +1 -1
- package/src/utilities/element.js +83 -26
- package/src/utilities/json.js +1 -1
- package/src/utilities/string.js +7 -29
- package/src/utilities/substitutions.js +18 -29
|
@@ -6,12 +6,6 @@ import { primitiveUtilities } from "occam-furtle";
|
|
|
6
6
|
const { primitiveFromNode } =primitiveUtilities;
|
|
7
7
|
|
|
8
8
|
export default class Substitution extends Element {
|
|
9
|
-
getSubstitution() {
|
|
10
|
-
const substitution = null;
|
|
11
|
-
|
|
12
|
-
return substitution;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
9
|
getPrimitive() {
|
|
16
10
|
const context = this.getContext(),
|
|
17
11
|
replacementNode = this.getReplacementNode(),
|
|
@@ -28,18 +22,6 @@ export default class Substitution extends Element {
|
|
|
28
22
|
return substitutionNode;
|
|
29
23
|
}
|
|
30
24
|
|
|
31
|
-
getNetavariableName() {
|
|
32
|
-
const metavariableName = null;
|
|
33
|
-
|
|
34
|
-
return metavariableName;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getVariableIdentifier() {
|
|
38
|
-
const variableIdentifier = null;
|
|
39
|
-
|
|
40
|
-
return variableIdentifier;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
25
|
matchSubstitutionNode(substitutionNode) {
|
|
44
26
|
const substitutionNodeA = substitutionNode; ///
|
|
45
27
|
|
|
@@ -68,12 +50,6 @@ export default class Substitution extends Element {
|
|
|
68
50
|
return equalTo;
|
|
69
51
|
}
|
|
70
52
|
|
|
71
|
-
isSimple() {
|
|
72
|
-
const simple = true;
|
|
73
|
-
|
|
74
|
-
return simple;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
53
|
isComplex() {
|
|
78
54
|
const simple = this.isSimple(),
|
|
79
55
|
complex = !simple;
|
|
@@ -81,12 +57,6 @@ export default class Substitution extends Element {
|
|
|
81
57
|
return complex;
|
|
82
58
|
}
|
|
83
59
|
|
|
84
|
-
isTrivial() {
|
|
85
|
-
const trivial = false;
|
|
86
|
-
|
|
87
|
-
return trivial;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
60
|
isNonTrivial() {
|
|
91
61
|
const trivial = this.isTrivial(),
|
|
92
62
|
nonTrivlal = !trivial;
|
|
@@ -94,22 +64,64 @@ export default class Substitution extends Element {
|
|
|
94
64
|
return nonTrivlal;
|
|
95
65
|
}
|
|
96
66
|
|
|
67
|
+
getVariable() {
|
|
68
|
+
const variable = null;
|
|
69
|
+
|
|
70
|
+
return variable;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
getSubstitution() {
|
|
74
|
+
const substitution = null;
|
|
75
|
+
|
|
76
|
+
return substitution;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
getMetavariable() {
|
|
80
|
+
const metavariable = null;
|
|
81
|
+
|
|
82
|
+
return metavariable;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getMetavariableName() {
|
|
86
|
+
const metavariableName = null;
|
|
87
|
+
|
|
88
|
+
return metavariableName;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
getVariableIdentifier() {
|
|
92
|
+
const variableIdentifier = null;
|
|
93
|
+
|
|
94
|
+
return variableIdentifier;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
isSimple() {
|
|
98
|
+
const simple = true;
|
|
99
|
+
|
|
100
|
+
return simple;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
isTermEqualToTerm(term) {
|
|
104
|
+
const termEqualToTerm = false;
|
|
105
|
+
|
|
106
|
+
return termEqualToTerm;
|
|
107
|
+
}
|
|
108
|
+
|
|
97
109
|
isFrameEqualToFrame(frame) {
|
|
98
110
|
const frameEqualToFrame = false;
|
|
99
111
|
|
|
100
112
|
return frameEqualToFrame;
|
|
101
113
|
}
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
const
|
|
115
|
+
isStatementEqualToStatement(statement) {
|
|
116
|
+
const statementEqualToStatement = false;
|
|
105
117
|
|
|
106
|
-
return
|
|
118
|
+
return statementEqualToStatement;
|
|
107
119
|
}
|
|
108
120
|
|
|
109
|
-
|
|
110
|
-
const
|
|
121
|
+
isReferenceEqualToReference(reference) {
|
|
122
|
+
const referenceEqualToReference = false;
|
|
111
123
|
|
|
112
|
-
return
|
|
124
|
+
return referenceEqualToReference;
|
|
113
125
|
}
|
|
114
126
|
|
|
115
127
|
compareTerm(term, context) {
|
|
@@ -136,6 +148,18 @@ export default class Substitution extends Element {
|
|
|
136
148
|
return compaaresToMetavariable;
|
|
137
149
|
}
|
|
138
150
|
|
|
151
|
+
compareMetavariableName(metavariableName) {
|
|
152
|
+
const comparesToMetavariableName = false;
|
|
153
|
+
|
|
154
|
+
return comparesToMetavariableName;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
compareVariableIdentifier(variableIdentifier) {
|
|
158
|
+
const comparesToVariableIdentifier = false;
|
|
159
|
+
|
|
160
|
+
return comparesToVariableIdentifier;
|
|
161
|
+
}
|
|
162
|
+
|
|
139
163
|
resolve(substitutions, generalContext, specificContext) {
|
|
140
164
|
const resolved = true;
|
|
141
165
|
|
package/src/element/term.js
CHANGED
|
@@ -44,12 +44,30 @@ export default define(class Term extends Element {
|
|
|
44
44
|
termNode = this.getTermNode();
|
|
45
45
|
|
|
46
46
|
const termNodeB = termNode, ///
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
termNodeAAMatchesTermBNodeB = termNodeA.match(termNodeB),
|
|
48
|
+
equalTo = termNodeAAMatchesTermBNodeB; ///
|
|
49
49
|
|
|
50
50
|
return equalTo;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
compareVariableIdentifier(variableIdentifier) {
|
|
54
|
+
let comparesToVariableIdentifier = false;
|
|
55
|
+
|
|
56
|
+
const singular = this.isSingular();
|
|
57
|
+
|
|
58
|
+
if (singular) {
|
|
59
|
+
const variableIdentifierA = variableIdentifier; ///
|
|
60
|
+
|
|
61
|
+
variableIdentifier = this.getVariableIdentifier();
|
|
62
|
+
|
|
63
|
+
const variableIdentifierB = variableIdentifier;
|
|
64
|
+
|
|
65
|
+
comparesToVariableIdentifier = (variableIdentifierA === variableIdentifierB);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return comparesToVariableIdentifier;
|
|
69
|
+
}
|
|
70
|
+
|
|
53
71
|
isValid(context) {
|
|
54
72
|
const termNode = this.getTermNode(),
|
|
55
73
|
termPresent = context.isTermPresentByTermNode(termNode),
|
|
@@ -255,15 +255,13 @@ export default class TopLevelAssertion extends Element {
|
|
|
255
255
|
suppositionVerifies = await supposition.verify(assignments, context)
|
|
256
256
|
|
|
257
257
|
if (suppositionVerifies) {
|
|
258
|
-
|
|
258
|
+
assignAssignments(assignments, context);
|
|
259
259
|
|
|
260
|
-
|
|
261
|
-
const subproofOrProofAssertion = supposition; ////
|
|
260
|
+
const subproofOrProofAssertion = supposition; ////
|
|
262
261
|
|
|
263
|
-
|
|
262
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
264
263
|
|
|
265
|
-
|
|
266
|
-
}
|
|
264
|
+
return true;
|
|
267
265
|
}
|
|
268
266
|
});
|
|
269
267
|
|
|
@@ -159,15 +159,13 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
159
159
|
suppositionVerifies = await supposition.verify(assignments, context)
|
|
160
160
|
|
|
161
161
|
if (suppositionVerifies) {
|
|
162
|
-
|
|
162
|
+
assignAssignments(assignments, context);
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
const subproofOrProofAssertion = supposition; ////
|
|
164
|
+
const subproofOrProofAssertion = supposition; ////
|
|
166
165
|
|
|
167
|
-
|
|
166
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
}
|
|
168
|
+
return true;
|
|
171
169
|
}
|
|
172
170
|
});
|
|
173
171
|
|
package/src/element/variable.js
CHANGED
package/src/process/assign.js
CHANGED
|
@@ -1,57 +1,134 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
return function (context) {
|
|
5
|
-
context.addVariable(variable);
|
|
3
|
+
import { variableFromVariableNode } from "../utilities/element";
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export function equalityAssignmentFromEquality(equality, context) {
|
|
6
|
+
const equalityAssignment = (context) => {
|
|
7
|
+
const equalityAdded = context.addEquality(equality);
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
context.debug(`Unable to assign the '${variableString}' variable with type '${variableTypeString}'.`);
|
|
9
|
+
return equalityAdded;
|
|
10
|
+
};
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
return equalityAssignment;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function judgementAssignmentFromJudgement(judgement, context) {
|
|
16
|
+
const judgementAssignment = (context) => {
|
|
17
|
+
const judgementAdded = context.addJudgement(judgement);
|
|
18
|
+
|
|
19
|
+
return judgementAdded;
|
|
16
20
|
};
|
|
21
|
+
|
|
22
|
+
return judgementAssignment;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
export function
|
|
20
|
-
|
|
21
|
-
const equalityString = equality.getString(),
|
|
22
|
-
equalityAdded = context.addEquality(equality),
|
|
23
|
-
assigned = equalityAdded; ///
|
|
25
|
+
export function leftVariableAssignmentFromEquality(equality, context) {
|
|
26
|
+
let leftVariableAssignment = null;
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
context.debug(`Unable to assign the '${equalityString}' equality.`);
|
|
28
|
+
const leftTermNode = equality.getLeftTermNode(),
|
|
29
|
+
singularVariableNode = leftTermNode.getSingularVariableNode();
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
if (singularVariableNode !== null) {
|
|
32
|
+
const type = equality.getType(),
|
|
33
|
+
leftVariableNode = singularVariableNode; ///
|
|
34
|
+
|
|
35
|
+
leftVariableAssignment = variableAssignmentFromVariableNodeAndType(leftVariableNode, type, context);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return leftVariableAssignment;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
|
-
export function
|
|
34
|
-
|
|
35
|
-
const judgementString = judgement.getString(),
|
|
36
|
-
judgementAdded = context.addJudgement(judgement),
|
|
37
|
-
assigned = judgementAdded; ///
|
|
41
|
+
export function rightVariableAssignmentFromEquality(equality, context) {
|
|
42
|
+
let rightVariableAssignment = null;
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
context.debug(`Unable to assign the '${judgementString}' judgement.`);
|
|
44
|
+
const rightTermNode = equality.getRightTermNode(),
|
|
45
|
+
singularVariableNode = rightTermNode.getSingularVariableNode();
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
if (singularVariableNode !== null) {
|
|
48
|
+
const type = equality.getType(),
|
|
49
|
+
rightVariableNode = singularVariableNode; ///
|
|
50
|
+
|
|
51
|
+
rightVariableAssignment = variableAssignmentFromVariableNodeAndType(rightVariableNode, type, context);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return rightVariableAssignment;
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
export function variableAssignmentFromTypeAssertion(typeAssertion, context) {
|
|
58
|
+
|
|
59
|
+
debugger
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
// const { Type, Variable } = elements,
|
|
62
|
+
// termNode = this.term.getNode();
|
|
63
|
+
//
|
|
64
|
+
// let type,
|
|
65
|
+
// provisional;
|
|
66
|
+
//
|
|
67
|
+
// provisional = this.type.isProvisional();
|
|
68
|
+
//
|
|
69
|
+
// if (!provisional) {
|
|
70
|
+
// type = this.type;
|
|
71
|
+
// } else {
|
|
72
|
+
// provisional = false;
|
|
73
|
+
//
|
|
74
|
+
// type = Type.fromTypeAndProvisional(this.type, provisional);
|
|
75
|
+
// }
|
|
76
|
+
//
|
|
77
|
+
// const singularVariableNode = termNode.getSingularVariableNode();
|
|
78
|
+
//
|
|
79
|
+
// if (singularVariableNode !== null) {
|
|
80
|
+
// const variableNode = singularVariableNode, ///
|
|
81
|
+
// variable = Variable.fromVariableNodeAndType(variableNode, type, context),
|
|
82
|
+
// variableAssignment = variableAssignmentFromVariable(variable),
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function variableAssignmentFromPrepertyAssertion(propertyAssertion, context) {
|
|
87
|
+
|
|
88
|
+
debugger
|
|
89
|
+
|
|
90
|
+
// let variable;
|
|
91
|
+
//
|
|
92
|
+
// const { Variable } = elements,
|
|
93
|
+
// termNode = this.term.getNode();
|
|
94
|
+
//
|
|
95
|
+
// variable = Variable.fromTermNode(termNode, context);
|
|
96
|
+
//
|
|
97
|
+
// if (variable !== null) {
|
|
98
|
+
// const variableIdentifier = variable.getIdentifier();
|
|
99
|
+
//
|
|
100
|
+
// variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
101
|
+
//
|
|
102
|
+
// variable = Variable.fromVariableAndPropertyRelation(variable, this.propertyRelation);
|
|
103
|
+
//
|
|
104
|
+
// const variableAssignment = variableAssignmentFromVariable(variable),
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default function assignAssignments(assignments, context) {
|
|
109
|
+
assignments.forEach((assignment) => {
|
|
110
|
+
assignment(context);
|
|
54
111
|
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function variableAssignmentFromVariableNodeAndType(variableNode, type, context) {
|
|
115
|
+
const variable = variableFromVariableNode(variableNode, context);
|
|
116
|
+
|
|
117
|
+
variable.setType(type);
|
|
118
|
+
|
|
119
|
+
const variableAssignment = (context) => {
|
|
120
|
+
context.addVariable(variable);
|
|
121
|
+
|
|
122
|
+
const variableTypeString = variable.getTypeString(),
|
|
123
|
+
variableString = variable.getString(),
|
|
124
|
+
assigned = true;
|
|
125
|
+
|
|
126
|
+
assigned ?
|
|
127
|
+
context.trace(`Assigned the '${variableString}' variable with type '${variableTypeString}'.`) :
|
|
128
|
+
context.debug(`Unable to assign the '${variableString}' variable with type '${variableTypeString}'.`);
|
|
129
|
+
|
|
130
|
+
return assigned;
|
|
131
|
+
};
|
|
55
132
|
|
|
56
|
-
return
|
|
133
|
+
return variableAssignment;
|
|
57
134
|
}
|
package/src/process/unify.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { ZipPass, queryUtilities } from "occam-languages";
|
|
4
4
|
|
|
5
|
-
import { findMetaTypeByMetaTypeName } from "../metaTypes";
|
|
6
5
|
import { termFromTermNode, frameFromFrameNode, statementFromStatementNode } from "../utilities/element";
|
|
7
6
|
|
|
8
7
|
const { nodeQuery } = queryUtilities;
|
|
@@ -161,7 +160,7 @@ class CombinatorPass extends ZipPass {
|
|
|
161
160
|
context = generalContext; ///
|
|
162
161
|
|
|
163
162
|
const metaTypeName = metaTypeNode.getMetaTypeName(),
|
|
164
|
-
metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
163
|
+
metaType = context.findMetaTypeByMetaTypeName(metaTypeName);
|
|
165
164
|
|
|
166
165
|
context = specificContext; ///
|
|
167
166
|
|
|
@@ -189,7 +188,7 @@ class CombinatorPass extends ZipPass {
|
|
|
189
188
|
context = generalContext; ///
|
|
190
189
|
|
|
191
190
|
const metaTypeName = metaTypeNode.getMetaTypeName(),
|
|
192
|
-
metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
191
|
+
metaType = context.findMetaTypeByMetaTypeName(metaTypeName);
|
|
193
192
|
|
|
194
193
|
context = specificContext; ///
|
|
195
194
|
|
package/src/process/validate.js
CHANGED
|
@@ -92,8 +92,8 @@ class StatementPass extends ForwardPass {
|
|
|
92
92
|
let success = false;
|
|
93
93
|
|
|
94
94
|
const statement = statementFromStatementNode(statementNode, context),
|
|
95
|
-
assignments = null,
|
|
96
95
|
stated = false,
|
|
96
|
+
assignments = null,
|
|
97
97
|
statementValidates = statement.validate(assignments, stated, context);
|
|
98
98
|
|
|
99
99
|
if (statementValidates) {
|
package/src/process/verify.js
CHANGED
|
@@ -295,8 +295,8 @@ class ConbinatorPass extends SimplePass {
|
|
|
295
295
|
let success = false;
|
|
296
296
|
|
|
297
297
|
const statement = statementFromStatementNode(statementNode, context),
|
|
298
|
-
assignments = null,
|
|
299
298
|
stated = false,
|
|
299
|
+
assignments = null,
|
|
300
300
|
statementValidates = statement.validate(assignments, stated, context);
|
|
301
301
|
|
|
302
302
|
if (statementValidates) {
|
package/src/utilities/element.js
CHANGED
|
@@ -7,6 +7,7 @@ import { baseTypeFromNothing } from "../utilities/type";
|
|
|
7
7
|
import { instantiateReference } from "../process/instantiate";
|
|
8
8
|
import { findMetaTypeByMetaTypeName } from "../metaTypes";
|
|
9
9
|
import { equivalenceStringFromTerms,
|
|
10
|
+
typeStringFromNominalTypeName,
|
|
10
11
|
rulsStringFromLabelsPremisesAndConclusion,
|
|
11
12
|
sectionStringFromHypothesesTopLevelAssertion,
|
|
12
13
|
subproofStringFromSuppositionsAndSubDerivation,
|
|
@@ -23,16 +24,15 @@ export function typeFromTypeNode(typeNode, context) {
|
|
|
23
24
|
type = baseType; ///
|
|
24
25
|
} else {
|
|
25
26
|
const { Type } = elements,
|
|
26
|
-
typeName = typeNode.getTypeName(),
|
|
27
|
-
typePrefixName = typeNode.getTypePrefixName(),
|
|
28
|
-
nominalTypeName = typeNode.getNominalTypeName(),
|
|
29
|
-
string = nominalTypeName, ///
|
|
30
27
|
node = typeNode, ///
|
|
31
|
-
name =
|
|
32
|
-
prefixName =
|
|
33
|
-
superTypes =
|
|
34
|
-
properties =
|
|
35
|
-
provisional =
|
|
28
|
+
name = nameFromTypeNode(typeNode, context),
|
|
29
|
+
prefixName = prefixNameFromTypeNode(typeNode, context),
|
|
30
|
+
superTypes = superTypesFromTypeNode(typeNode, context),
|
|
31
|
+
properties = propertiesFromTypeNode(typeNode, context),
|
|
32
|
+
provisional = provisionalFromTypeNode(typeNode, context),
|
|
33
|
+
nominalTypeName = nominalTypeNameFromTypeNode(typeNode, context),
|
|
34
|
+
typeString = typeStringFromNominalTypeName(nominalTypeName),
|
|
35
|
+
string = typeString; ///
|
|
36
36
|
|
|
37
37
|
type = new Type(context, string, node, name, prefixName, superTypes, properties, provisional);
|
|
38
38
|
}
|
|
@@ -195,7 +195,7 @@ export function theoremFromTheoremNode(theoremNode, context) {
|
|
|
195
195
|
|
|
196
196
|
export function metaTypeFromMetaTypeNode(metaTypeNode, context) {
|
|
197
197
|
const metaTypeName = metaTypeNode.getMetaTypeName(),
|
|
198
|
-
metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
198
|
+
metaType = context.findMetaTypeByMetaTypeName(metaTypeName);
|
|
199
199
|
|
|
200
200
|
return metaType;
|
|
201
201
|
}
|
|
@@ -236,21 +236,15 @@ export function subproofFromSubproofNode(subproofNode, context) {
|
|
|
236
236
|
return subproof;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
export function
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
string = context.nodeAsString(node),
|
|
247
|
-
leftTerm = leftTermFromEqualityNode(equalityNode, context),
|
|
248
|
-
rightTerm = rightTermFromEqualityNode(equalityNode, context);
|
|
249
|
-
|
|
250
|
-
equality = new Equality(context, string, node, leftTerm, rightTerm);
|
|
251
|
-
}
|
|
239
|
+
export function equalityFromEqualityNode(equalityNode, context) {
|
|
240
|
+
const { Equality } = elements,
|
|
241
|
+
node = equalityNode, ///
|
|
242
|
+
string = context.nodeAsString(node),
|
|
243
|
+
leftTerm = leftTermFromEqualityNode(equalityNode, context),
|
|
244
|
+
rightTerm = rightTermFromEqualityNode(equalityNode, context),
|
|
245
|
+
subproof = new Equality(context, string, node, leftTerm, rightTerm);
|
|
252
246
|
|
|
253
|
-
return
|
|
247
|
+
return subproof;
|
|
254
248
|
}
|
|
255
249
|
|
|
256
250
|
export function deductionFromDeductionNode(deductionNode, context) {
|
|
@@ -713,6 +707,13 @@ export function metavariableDeclarationFromMetavariableDeclarationNode(metavaria
|
|
|
713
707
|
return metavariableDeclaration;
|
|
714
708
|
}
|
|
715
709
|
|
|
710
|
+
export function nameFromTypeNode(typeNode, context) {
|
|
711
|
+
const typeName = typeNode.getTypeName(),
|
|
712
|
+
name = typeName; ///
|
|
713
|
+
|
|
714
|
+
return name;
|
|
715
|
+
}
|
|
716
|
+
|
|
716
717
|
export function typeFromTermNode(termNode, context) {
|
|
717
718
|
const type = null;
|
|
718
719
|
|
|
@@ -793,6 +794,25 @@ export function referenceFromStepNode(stepNode, context) {
|
|
|
793
794
|
return reference;
|
|
794
795
|
}
|
|
795
796
|
|
|
797
|
+
export function superTypesFromTypeNode(typeNode, context) {
|
|
798
|
+
const superTypes = null;
|
|
799
|
+
|
|
800
|
+
return superTypes;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export function propertiesFromTypeNode(typeNode, context) {
|
|
804
|
+
const properties = null;
|
|
805
|
+
|
|
806
|
+
return properties;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
export function prefixNameFromTypeNode(typeNode, context) {
|
|
810
|
+
const typePrefixName = typeNode.getTypePrefixName(),
|
|
811
|
+
prefixName = typePrefixName; ///
|
|
812
|
+
|
|
813
|
+
return prefixName;
|
|
814
|
+
}
|
|
815
|
+
|
|
796
816
|
export function conclusionFromRuleNode(ruleNode, context) {
|
|
797
817
|
const conclusionNode = ruleNode.getConclusionNode(),
|
|
798
818
|
conclusion = conclusionFromConclusionNode(conclusionNode, context);
|
|
@@ -833,6 +853,12 @@ export function derivationFromProofNode(proofNode, context) {
|
|
|
833
853
|
return derivation;
|
|
834
854
|
}
|
|
835
855
|
|
|
856
|
+
export function provisionalFromTypeNode(typeNode, context) {
|
|
857
|
+
const provisional = null;
|
|
858
|
+
|
|
859
|
+
return provisional;
|
|
860
|
+
}
|
|
861
|
+
|
|
836
862
|
export function termFromConstructorNode(ocnstructorNode, context) {
|
|
837
863
|
const termNode = ocnstructorNode.getTermNode(),
|
|
838
864
|
term = termFromTermNode(termNode, context);
|
|
@@ -859,6 +885,13 @@ export function statementFromPremiseNode(premiseNode, context) {
|
|
|
859
885
|
return statement;
|
|
860
886
|
}
|
|
861
887
|
|
|
888
|
+
export function leftTermFromEqualityNode(equalityNode, context) {
|
|
889
|
+
const leftTermNode = equalityNode.getLeftTermNode(),
|
|
890
|
+
leftTerm = termFromTermNode(leftTermNode, context);
|
|
891
|
+
|
|
892
|
+
return leftTerm;
|
|
893
|
+
}
|
|
894
|
+
|
|
862
895
|
export function termsFromEquivalenceNode(equivalenceNode, context) {
|
|
863
896
|
const termNodes = equivalenceNode.getTermNodes(),
|
|
864
897
|
terms = termsFromTermNodes(termNodes, context);
|
|
@@ -897,6 +930,25 @@ export function conjectureFromSectionNode(sectionNode, context) {
|
|
|
897
930
|
return conjecture;
|
|
898
931
|
}
|
|
899
932
|
|
|
933
|
+
export function rightTermFromEqualityNode(equalityNode, context) {
|
|
934
|
+
const rightTermNode = equalityNode.getRightTermNode(),
|
|
935
|
+
rightTerm = termFromTermNode(rightTermNode, context);
|
|
936
|
+
|
|
937
|
+
return rightTerm;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
export function equalityFromStatementNode(statementNode, context) {
|
|
941
|
+
let equality = null;
|
|
942
|
+
|
|
943
|
+
const equalityNode = statementNode.getEqualityNode();
|
|
944
|
+
|
|
945
|
+
if (equalityNode !== null) {
|
|
946
|
+
equality = equalityFromEqualityNode(equalityNode, context);
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
return equality;
|
|
950
|
+
}
|
|
951
|
+
|
|
900
952
|
export function termFromTypeAssertionNode(typeAssertionNode, context) {
|
|
901
953
|
const termNode = typeAssertionNode.getTermNode(),
|
|
902
954
|
term = termFromTermNode(termNode, context);
|
|
@@ -956,6 +1008,12 @@ export function stepFromStepOrSubproofNode(stepOrSubproofNode, context) {
|
|
|
956
1008
|
return step;
|
|
957
1009
|
}
|
|
958
1010
|
|
|
1011
|
+
export function nominalTypeNameFromTypeNode(typeNode, context) {
|
|
1012
|
+
const nominalTypeName = typeNode.getNominalTypeName();
|
|
1013
|
+
|
|
1014
|
+
return nominalTypeName;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
959
1017
|
export function assumptionFromJudgementNode(judgementNode, context) {
|
|
960
1018
|
const assumptionNode = judgementNode.getAssumptionNode(),
|
|
961
1019
|
assumption = assumptionFromAssumptionNode(assumptionNode, context);
|
|
@@ -1543,7 +1601,7 @@ export function termSubstitutionFromStatementSubstitutionNode(statementSubstitut
|
|
|
1543
1601
|
const termSubstitutionNode = statementSubstitutionNode.getTermSubstitutionNode();
|
|
1544
1602
|
|
|
1545
1603
|
if (termSubstitutionNode !== null) {
|
|
1546
|
-
termSubstitution =
|
|
1604
|
+
termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
|
|
1547
1605
|
}
|
|
1548
1606
|
|
|
1549
1607
|
return termSubstitution;
|
|
@@ -1676,4 +1734,3 @@ export function stepsOrSubproofsFromSubDerivationNode(subDerivationNode, context
|
|
|
1676
1734
|
|
|
1677
1735
|
return stepsOrSubproofs;
|
|
1678
1736
|
}
|
|
1679
|
-
|
package/src/utilities/json.js
CHANGED