occam-verify-cli 1.0.800 → 1.0.806
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 +2 -2
- package/lib/context/ephemeral.js +186 -69
- package/lib/context/file/nominal.js +87 -52
- package/lib/context/liminal.js +2 -2
- package/lib/context/proof.js +55 -55
- package/lib/context/synthetic.js +151 -74
- package/lib/context.js +57 -17
- package/lib/element/assertion/defined.js +3 -3
- package/lib/element/assumption/metaLevel.js +6 -4
- package/lib/element/combinator.js +4 -2
- package/lib/element/conclusion.js +4 -2
- package/lib/element/constructor.js +4 -2
- package/lib/element/declaration/metavariable.js +10 -9
- package/lib/element/declaration/variable.js +7 -7
- package/lib/element/deduction.js +4 -2
- package/lib/element/label.js +9 -5
- package/lib/element/metavariable.js +34 -34
- package/lib/element/proofAssertion/premise.js +4 -3
- package/lib/element/proofAssertion/step.js +4 -2
- package/lib/element/reference.js +6 -4
- package/lib/element/statement.js +9 -1
- package/lib/element/substitution/frame.js +43 -29
- package/lib/element/substitution/reference.js +38 -28
- package/lib/element/substitution/statement.js +46 -38
- package/lib/element/substitution/term.js +49 -35
- package/lib/element/variable.js +6 -7
- package/lib/preamble.js +1 -2
- package/lib/process/assign.js +11 -10
- package/lib/process/equate.js +3 -2
- package/lib/process/unify.js +7 -7
- package/lib/utilities/context.js +13 -5
- package/lib/utilities/element.js +1 -1
- package/lib/utilities/equivalences.js +131 -0
- package/lib/utilities/json.js +59 -1
- package/lib/utilities/validation.js +4 -3
- package/package.json +2 -2
- package/src/context/branching.js +2 -2
- package/src/context/ephemeral.js +421 -237
- package/src/context/file/nominal.js +127 -77
- package/src/context/liminal.js +2 -2
- package/src/context/proof.js +81 -82
- package/src/context/synthetic.js +198 -88
- package/src/context.js +81 -20
- package/src/element/assertion/defined.js +4 -4
- package/src/element/assumption/metaLevel.js +8 -6
- package/src/element/combinator.js +4 -2
- package/src/element/conclusion.js +4 -2
- package/src/element/constructor.js +4 -2
- package/src/element/declaration/metavariable.js +10 -8
- package/src/element/declaration/variable.js +8 -7
- package/src/element/deduction.js +4 -2
- package/src/element/label.js +11 -7
- package/src/element/metavariable.js +11 -11
- package/src/element/proofAssertion/premise.js +4 -4
- package/src/element/proofAssertion/step.js +4 -2
- package/src/element/reference.js +7 -5
- package/src/element/statement.js +14 -0
- package/src/element/substitution/frame.js +47 -32
- package/src/element/substitution/reference.js +44 -34
- package/src/element/substitution/statement.js +63 -54
- package/src/element/substitution/term.js +53 -38
- package/src/element/variable.js +6 -7
- package/src/preamble.js +0 -1
- package/src/process/assign.js +17 -14
- package/src/process/equate.js +3 -1
- package/src/process/unify.js +10 -13
- package/src/utilities/context.js +13 -6
- package/src/utilities/element.js +1 -0
- package/src/utilities/equivalences.js +158 -0
- package/src/utilities/json.js +66 -0
- package/src/utilities/validation.js +6 -5
- package/lib/element/equivalences.js +0 -173
- package/src/element/equivalences.js +0 -237
package/src/process/assign.js
CHANGED
|
@@ -14,9 +14,10 @@ export function equalityAssignmentFromEquality(equality, context) {
|
|
|
14
14
|
|
|
15
15
|
export function judgementAssignmentFromJudgement(judgement, context) {
|
|
16
16
|
const judgementAssignment = (context) => {
|
|
17
|
-
const
|
|
17
|
+
const declaredJudgement = judgement, ///
|
|
18
|
+
declaredJudgementAdded = context.addDeclaredJudgement(declaredJudgement);
|
|
18
19
|
|
|
19
|
-
return
|
|
20
|
+
return declaredJudgementAdded;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
return judgementAssignment;
|
|
@@ -27,12 +28,12 @@ export function leftVariableAssignmentFromEquality(equality, context) {
|
|
|
27
28
|
///
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
const
|
|
31
|
+
const type = equality.getType(),
|
|
32
|
+
leftTermNode = equality.getLeftTermNode(),
|
|
31
33
|
singularVariableNode = leftTermNode.getSingularVariableNode();
|
|
32
34
|
|
|
33
35
|
if (singularVariableNode !== null) {
|
|
34
|
-
const
|
|
35
|
-
leftVariableNode = singularVariableNode; ///
|
|
36
|
+
const leftVariableNode = singularVariableNode; ///
|
|
36
37
|
|
|
37
38
|
leftVariableAssignment = variableAssignmentFromVariableNodeAndType(leftVariableNode, type, context);
|
|
38
39
|
}
|
|
@@ -45,12 +46,12 @@ export function rightVariableAssignmentFromEquality(equality, context) {
|
|
|
45
46
|
///
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
const
|
|
49
|
+
const type = equality.getType(),
|
|
50
|
+
rightTermNode = equality.getRightTermNode(),
|
|
49
51
|
singularVariableNode = rightTermNode.getSingularVariableNode();
|
|
50
52
|
|
|
51
53
|
if (singularVariableNode !== null) {
|
|
52
|
-
const
|
|
53
|
-
rightVariableNode = singularVariableNode; ///
|
|
54
|
+
const rightVariableNode = singularVariableNode; ///
|
|
54
55
|
|
|
55
56
|
rightVariableAssignment = variableAssignmentFromVariableNodeAndType(rightVariableNode, type, context);
|
|
56
57
|
}
|
|
@@ -109,15 +110,17 @@ function variableAssignmentFromVariableNodeAndType(variableNode, type, context)
|
|
|
109
110
|
variable.setType(type);
|
|
110
111
|
|
|
111
112
|
const variableAssignment = (context) => {
|
|
112
|
-
|
|
113
|
+
const declaredVariable = variable; ///
|
|
113
114
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
context.addDeclaredVariable(declaredVariable);
|
|
116
|
+
|
|
117
|
+
const declaredVariableTypeString = declaredVariable.getTypeString(),
|
|
118
|
+
declaredVariableString = declaredVariable.getString(),
|
|
119
|
+
assigned = true; ///
|
|
117
120
|
|
|
118
121
|
assigned ?
|
|
119
|
-
context.trace(`Assigned the '${
|
|
120
|
-
context.debug(`Unable to assign the '${
|
|
122
|
+
context.trace(`Assigned the '${declaredVariableString}' declared variable with type '${declaredVariableTypeString}'.`) :
|
|
123
|
+
context.debug(`Unable to assign the '${declaredVariableString}' declared variable with type '${declaredVariableTypeString}'.`);
|
|
121
124
|
|
|
122
125
|
return assigned;
|
|
123
126
|
};
|
package/src/process/equate.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { queryUtilities, EquivalencePass } from "occam-languages";
|
|
4
4
|
|
|
5
|
+
import { findEquivalenceByTermNodes } from "../utilities/equivalences";
|
|
6
|
+
|
|
5
7
|
const { nodeQuery } = queryUtilities;
|
|
6
8
|
|
|
7
9
|
const termNodeQuery = nodeQuery("/term");
|
|
@@ -29,7 +31,7 @@ class EquationalPass extends EquivalencePass {
|
|
|
29
31
|
leftTermNode,
|
|
30
32
|
rightTermNode
|
|
31
33
|
],
|
|
32
|
-
equivalence =
|
|
34
|
+
equivalence = findEquivalenceByTermNodes(equivalences, termNodes);
|
|
33
35
|
|
|
34
36
|
if (equivalence !== null) {
|
|
35
37
|
success = true;
|
package/src/process/unify.js
CHANGED
|
@@ -126,14 +126,13 @@ class MetaLevelPass extends ZipPassBase {
|
|
|
126
126
|
let success = false;
|
|
127
127
|
|
|
128
128
|
const termNode = specificTermNode, ///
|
|
129
|
-
variableNode = generalTermVariableNode
|
|
130
|
-
variableIdentifier = variableNode.getVariableIdentifier();
|
|
129
|
+
variableNode = generalTermVariableNode; ///
|
|
131
130
|
|
|
132
131
|
let context;
|
|
133
132
|
|
|
134
133
|
context = generalContext; ///
|
|
135
134
|
|
|
136
|
-
const variable = context.
|
|
135
|
+
const variable = context.findVariableByVariableNode(variableNode);
|
|
137
136
|
|
|
138
137
|
context = specificContext; ///
|
|
139
138
|
|
|
@@ -409,14 +408,13 @@ class SubstitutionPass extends ZipPass {
|
|
|
409
408
|
let success = false;
|
|
410
409
|
|
|
411
410
|
const termNode = specificTermNode, ///
|
|
412
|
-
variableNode = generalTermVariableNode
|
|
413
|
-
variableIdentifier = variableNode.getVariableIdentifier();
|
|
411
|
+
variableNode = generalTermVariableNode; ///
|
|
414
412
|
|
|
415
413
|
let context;
|
|
416
414
|
|
|
417
415
|
context = generalContext; ///
|
|
418
416
|
|
|
419
|
-
const variable = context.
|
|
417
|
+
const variable = context.findVariableByVariableNode(variableNode);
|
|
420
418
|
|
|
421
419
|
context = specificContext; ///
|
|
422
420
|
|
|
@@ -442,14 +440,13 @@ class IntrinsicLevelPass extends ZipPass {
|
|
|
442
440
|
let success = false;
|
|
443
441
|
|
|
444
442
|
const termNode = specificTermNode, ///
|
|
445
|
-
variableNode = generalTermVariableNode
|
|
446
|
-
variableIdentifier = variableNode.getVariableIdentifier();
|
|
443
|
+
variableNode = generalTermVariableNode; ///
|
|
447
444
|
|
|
448
445
|
let context;
|
|
449
446
|
|
|
450
447
|
context = generalContext; ///
|
|
451
448
|
|
|
452
|
-
const variable = context.
|
|
449
|
+
const variable = context.findVariableByVariableNode(variableNode);
|
|
453
450
|
|
|
454
451
|
context = specificContext; ///
|
|
455
452
|
|
|
@@ -510,10 +507,10 @@ export function unifySubstitution(generalSubstitution, specificSubstitution, gen
|
|
|
510
507
|
let substitutionUnifies = false;
|
|
511
508
|
|
|
512
509
|
const generalSubstitutionNode = generalSubstitution.getNode(),
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
510
|
+
specificSubstitutionNode = specificSubstitution.getNode(),
|
|
511
|
+
generalNode = generalSubstitutionNode, ///
|
|
512
|
+
specificNode = specificSubstitutionNode, ///
|
|
513
|
+
success = substitutionPass.run(generalNode, specificNode, generalContext, specificContext);
|
|
517
514
|
|
|
518
515
|
if (success) {
|
|
519
516
|
substitutionUnifies = true;
|
package/src/utilities/context.js
CHANGED
|
@@ -10,6 +10,7 @@ import IllativeContext from "../context/illative";
|
|
|
10
10
|
import EphemeralContext from "../context/ephemeral";
|
|
11
11
|
import BranchingContext from "../context/branching";
|
|
12
12
|
import SyntheticContext from "../context/synthetic";
|
|
13
|
+
import NominalFileContext from "../context/file/nominal";
|
|
13
14
|
|
|
14
15
|
import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../utilities/json";
|
|
15
16
|
|
|
@@ -20,6 +21,18 @@ export function join(innerFunction, ...contexts) {
|
|
|
20
21
|
return innerFunction(context);
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
export function ablate(innerFunction, context) {
|
|
25
|
+
let contextNominalFileContext = (context instanceof NominalFileContext);
|
|
26
|
+
|
|
27
|
+
while (!contextNominalFileContext) {
|
|
28
|
+
context = context.getContext();
|
|
29
|
+
|
|
30
|
+
contextNominalFileContext = (context instanceof NominalFileContext)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return innerFunction(context);
|
|
34
|
+
}
|
|
35
|
+
|
|
23
36
|
export function choose(innerFunction, context) {
|
|
24
37
|
const branchingContext = BranchingContext.fromNothing(context);
|
|
25
38
|
|
|
@@ -53,12 +66,6 @@ export function descend(innerFunction, context) {
|
|
|
53
66
|
}
|
|
54
67
|
|
|
55
68
|
export function attempt(innerFunction, context) {
|
|
56
|
-
const contextEphemeralContext = (context instanceof EphemeralContext);
|
|
57
|
-
|
|
58
|
-
if (contextEphemeralContext) {
|
|
59
|
-
context = context.getContext();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
69
|
const ephemeralContext = EphemeralContext.fromNothing(context);
|
|
63
70
|
|
|
64
71
|
context = ephemeralContext; ///
|
package/src/utilities/element.js
CHANGED
|
@@ -775,6 +775,7 @@ export function referenceSubstitutionFromReferenceSubstitutionNode(referenceSubs
|
|
|
775
775
|
}
|
|
776
776
|
|
|
777
777
|
export function statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
778
|
+
|
|
778
779
|
const { StatementSubstitution } = elements,
|
|
779
780
|
node = statementSubstitutionNode, ///
|
|
780
781
|
string = context.nodeAsString(node),
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
5
|
+
import { variablesFromTerm } from "../utilities/equivalence";
|
|
6
|
+
|
|
7
|
+
const { push, separate } = arrayUtilities;
|
|
8
|
+
|
|
9
|
+
export function mergeEquivalences(equivalencesA, equivalencesB, context) {
|
|
10
|
+
equivalencesA = [ ///
|
|
11
|
+
...equivalencesA
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
equivalencesB.forEach((equivalenceB) => {
|
|
15
|
+
equivalencesA = mergeEquivalence(equivalencesA, equivalenceB, context);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return equivalencesA;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function findEquivalenceByTerm(equivalences, term) {
|
|
22
|
+
const equivalence = equivalences.find((equivalence) => {
|
|
23
|
+
const equivalenceComparesToTerm = equivalence.compareTerm(term);
|
|
24
|
+
|
|
25
|
+
if (equivalenceComparesToTerm) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}) || null;
|
|
29
|
+
|
|
30
|
+
return equivalence;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function findEquivalenceByTermNodes(equivalences, termNodes) {
|
|
34
|
+
const equivalence = equivalences.find((equivalence) => {
|
|
35
|
+
const termNodeMatches = equivalence.matchTermNodes(termNodes);
|
|
36
|
+
|
|
37
|
+
if (termNodeMatches) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}) || null;
|
|
41
|
+
|
|
42
|
+
return equivalence;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function separateGroundedTermsAndDefinedVariables(equivalences, groundedTerms, definedVariables, context) {
|
|
46
|
+
let groundedEquivalences,
|
|
47
|
+
remainingEquivalences,
|
|
48
|
+
initiallyGroundedEquivalences,
|
|
49
|
+
implicitlyGroundedEquivalences;
|
|
50
|
+
|
|
51
|
+
remainingEquivalences = [];
|
|
52
|
+
|
|
53
|
+
initiallyGroundedEquivalences = [];
|
|
54
|
+
|
|
55
|
+
separateInitiallyGroundedEquivalences(equivalences, remainingEquivalences, initiallyGroundedEquivalences, context);
|
|
56
|
+
|
|
57
|
+
const initiallyGroundedEquivalencesLength = initiallyGroundedEquivalences.getLength();
|
|
58
|
+
|
|
59
|
+
if (initiallyGroundedEquivalencesLength > 0) {
|
|
60
|
+
groundedEquivalences = initiallyGroundedEquivalences; ///
|
|
61
|
+
|
|
62
|
+
let implicitlyGroundedEquivalencesLength = 1;
|
|
63
|
+
|
|
64
|
+
while (implicitlyGroundedEquivalencesLength > 0) {
|
|
65
|
+
let definedVariablesLength = 0,
|
|
66
|
+
previousDefinedVariablesLength = -1;
|
|
67
|
+
|
|
68
|
+
while (definedVariablesLength > previousDefinedVariablesLength) {
|
|
69
|
+
previousDefinedVariablesLength = definedVariablesLength; ///
|
|
70
|
+
|
|
71
|
+
groundedTermsFromGroundedEquivalencesAndDefinedVariables(groundedEquivalences, definedVariables, groundedTerms, context);
|
|
72
|
+
|
|
73
|
+
definedVariablesFromGroundedTerms(groundedTerms, definedVariables, context);
|
|
74
|
+
|
|
75
|
+
definedVariablesLength = definedVariables.length;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
equivalences = remainingEquivalences; ///
|
|
79
|
+
|
|
80
|
+
remainingEquivalences = [];
|
|
81
|
+
|
|
82
|
+
implicitlyGroundedEquivalences = [];
|
|
83
|
+
|
|
84
|
+
separateImplicitlyGroundedEquivalences(equivalences, remainingEquivalences, implicitlyGroundedEquivalences, definedVariables, context);
|
|
85
|
+
|
|
86
|
+
push(groundedEquivalences, implicitlyGroundedEquivalences);
|
|
87
|
+
|
|
88
|
+
implicitlyGroundedEquivalencesLength = implicitlyGroundedEquivalences.getLength(); ///
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function mergeEquivalence(equivalencesA, equivalenceB, context) {
|
|
94
|
+
const mergedEquivalences = [];
|
|
95
|
+
|
|
96
|
+
equivalencesA.forEach((equivalenceA) => {
|
|
97
|
+
const equivalenceBDisjointFromEquivalenceA = equivalenceB.isDisjointFrom(equivalenceA);
|
|
98
|
+
|
|
99
|
+
if (equivalenceBDisjointFromEquivalenceA) {
|
|
100
|
+
const mergedEquivalence = equivalenceB; ///
|
|
101
|
+
|
|
102
|
+
mergedEquivalences.push(mergedEquivalence);
|
|
103
|
+
} else {
|
|
104
|
+
equivalenceB = equivalenceB.mergedWith(equivalenceA, context);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const mergedEquivalence = equivalenceB; ///
|
|
109
|
+
|
|
110
|
+
mergedEquivalences.push(mergedEquivalence);
|
|
111
|
+
|
|
112
|
+
equivalencesA = mergedEquivalences; ///
|
|
113
|
+
|
|
114
|
+
return equivalencesA;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function separateInitiallyGroundedEquivalences(equivalences, remainingEquivalences, initiallyGroundedEquivalences, context) {
|
|
118
|
+
separate(equivalences, remainingEquivalences, initiallyGroundedEquivalences, (equivalence) => {
|
|
119
|
+
const equivalenceInitiallyGrounded = equivalence.isInitiallyGrounded(context);
|
|
120
|
+
|
|
121
|
+
if (!equivalenceInitiallyGrounded) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function separateImplicitlyGroundedEquivalences(equivalences, remainingEquivalences, implicitlyGroundedEquivalences, definedVariables, context) {
|
|
128
|
+
separate(equivalences, remainingEquivalences, implicitlyGroundedEquivalences, (equivalence) => {
|
|
129
|
+
const equivalenceImplicitlyGrounded = equivalence.isImplicitlyGrounded(definedVariables, context);
|
|
130
|
+
|
|
131
|
+
if (!equivalenceImplicitlyGrounded) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function definedVariablesFromGroundedTerms(groundedTerms, definedVariables, context) {
|
|
138
|
+
groundedTerms.forEach((groundedTerm) => {
|
|
139
|
+
const term = groundedTerm, ///
|
|
140
|
+
variables = variablesFromTerm(term, context);
|
|
141
|
+
|
|
142
|
+
variables.forEach((variable) => {
|
|
143
|
+
const definedVariablesIncludesTermVariable = definedVariables.includes(variable);
|
|
144
|
+
|
|
145
|
+
if (!definedVariablesIncludesTermVariable) {
|
|
146
|
+
const definedVariable = variable; ///
|
|
147
|
+
|
|
148
|
+
definedVariables.push(definedVariable);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function groundedTermsFromGroundedEquivalencesAndDefinedVariables(groundedEquivalences, definedVariables, groundedTerms, context) {
|
|
155
|
+
groundedEquivalences.forEach((groundedEquivalence) => {
|
|
156
|
+
groundedEquivalence.getGroundedTerms(definedVariables, groundedTerms, context);
|
|
157
|
+
});
|
|
158
|
+
}
|
package/src/utilities/json.js
CHANGED
|
@@ -686,6 +686,23 @@ export function ephemeralContextFromJSON(json, context) {
|
|
|
686
686
|
return emphemeralContext;
|
|
687
687
|
}
|
|
688
688
|
|
|
689
|
+
export function declaredVariablesFromJSON(json, context) {
|
|
690
|
+
let { declaredVariables } = json;
|
|
691
|
+
|
|
692
|
+
const { Variable } = elements,
|
|
693
|
+
declaredVariablesJSON = declaredVariables; ///
|
|
694
|
+
|
|
695
|
+
declaredVariables = declaredVariablesJSON.map((declaredVariableJSON) => {
|
|
696
|
+
const json = declaredVariableJSON, ///
|
|
697
|
+
variable = Variable.fromJSON(json, context),
|
|
698
|
+
declaredVariable = variable; ///
|
|
699
|
+
|
|
700
|
+
return declaredVariable;
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
return declaredVariables;
|
|
704
|
+
}
|
|
705
|
+
|
|
689
706
|
export function propertyRelationsFromJSON(json, context) {
|
|
690
707
|
let { propertyRelations } = json;
|
|
691
708
|
|
|
@@ -718,6 +735,23 @@ export function metaLevelAssumptionsFromJSON(json, context) {
|
|
|
718
735
|
return metaLevelAssumptions;
|
|
719
736
|
}
|
|
720
737
|
|
|
738
|
+
export function declaredMetavariablesFromJSON(json, context) {
|
|
739
|
+
let { declaredMetavariables } = json;
|
|
740
|
+
|
|
741
|
+
const { Metavariable } = elements,
|
|
742
|
+
declaredMetavariablesJSON = declaredMetavariables; ///
|
|
743
|
+
|
|
744
|
+
declaredMetavariables = declaredMetavariablesJSON.map((declaredMetavariableJSON) => {
|
|
745
|
+
const json = declaredMetavariableJSON, ///
|
|
746
|
+
metavariable = Metavariable.fromJSON(json, context),
|
|
747
|
+
declaredMetavariable = metavariable; ///
|
|
748
|
+
|
|
749
|
+
return declaredMetavariable;
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
return declaredMetavariables;
|
|
753
|
+
}
|
|
754
|
+
|
|
721
755
|
export function nameToNameJSON(name) {
|
|
722
756
|
const nameJSON = name; ///
|
|
723
757
|
|
|
@@ -760,6 +794,12 @@ export function negatedToNegatedJSON(negated) {
|
|
|
760
794
|
return negatedJSON;
|
|
761
795
|
}
|
|
762
796
|
|
|
797
|
+
export function ariableToVariableJSON(ariable) {
|
|
798
|
+
const ariableJSON = ariable.toJSON();
|
|
799
|
+
|
|
800
|
+
return ariableJSON;
|
|
801
|
+
}
|
|
802
|
+
|
|
763
803
|
export function metaTypeToMetaTypeJSON(metaType) {
|
|
764
804
|
const metaTypeJSON = (metaType !== null) ?
|
|
765
805
|
metaType.toJSON() :
|
|
@@ -846,6 +886,12 @@ export function procedureReferenceToProcedureReferenceJSON(procedureReference) {
|
|
|
846
886
|
return procedureReferenceJSON;
|
|
847
887
|
}
|
|
848
888
|
|
|
889
|
+
export function declaredMetavariableToDEclaredMetavariableJSON(declaredMetavariable) {
|
|
890
|
+
const declaredMetavariableJSON = declaredMetavariable.toJSON();
|
|
891
|
+
|
|
892
|
+
return declaredMetavariableJSON;
|
|
893
|
+
}
|
|
894
|
+
|
|
849
895
|
export function substitutionFromSubstitutionJSON(json, context) {
|
|
850
896
|
const { TermSubstitution, FrameSubstitution, StatementSubstitution, ReferenceSubstitution } = elements,
|
|
851
897
|
substitution = TermSubstitution.fromJSON(json, context) ||
|
|
@@ -1136,6 +1182,16 @@ export function propertyRelationsToPropertyRelationsJSON(propertyRelations) {
|
|
|
1136
1182
|
return propertyRelationsJSON;
|
|
1137
1183
|
}
|
|
1138
1184
|
|
|
1185
|
+
export function declaredVariablesToDeclaredVariablesJSON(declaredVariables) {
|
|
1186
|
+
const declaredVariablesJSON = declaredVariables.map((declaredVariable) => {
|
|
1187
|
+
const declaredVariableJSON = declaredVariable.toJSON();
|
|
1188
|
+
|
|
1189
|
+
return declaredVariableJSON;
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
return declaredVariablesJSON;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1139
1195
|
export function metaLevelAssumptionsToMetaLevelAssumptionsJSON(metaLevelAssumptions) {
|
|
1140
1196
|
const metaLevelAssumptionsJSON = metaLevelAssumptions.map((metaLevelAssumption) => {
|
|
1141
1197
|
const metaLevelAssumptionJSON = metaLevelAssumption.toJSON();
|
|
@@ -1146,6 +1202,16 @@ export function metaLevelAssumptionsToMetaLevelAssumptionsJSON(metaLevelAssumpti
|
|
|
1146
1202
|
return metaLevelAssumptionsJSON;
|
|
1147
1203
|
}
|
|
1148
1204
|
|
|
1205
|
+
export function declaredMetavariablesToDeclaredMetavariablesJSON(declaredMetavariables) {
|
|
1206
|
+
const declaredMetavariablesJSON = declaredMetavariables.map((declaredMetavariable) => {
|
|
1207
|
+
const declaredMetavariableJSON = declaredMetavariable.toJSON();
|
|
1208
|
+
|
|
1209
|
+
return declaredMetavariableJSON;
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
return declaredMetavariablesJSON;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1149
1215
|
function findTypeByName(name, context) {
|
|
1150
1216
|
const typeName = name, ///
|
|
1151
1217
|
type = context.findTypeByTypeName(typeName);
|
|
@@ -101,18 +101,19 @@ function validateStatementAsMetavariable(statement, context) {
|
|
|
101
101
|
if (metavariable !== null) {
|
|
102
102
|
statementValidatesAsMetavariable = true;
|
|
103
103
|
|
|
104
|
-
const { TermSubstitution, FrameSubstitution } = elements
|
|
105
|
-
generalContext = context, ///
|
|
106
|
-
specificContext = context; ///
|
|
104
|
+
const { TermSubstitution, FrameSubstitution } = elements;
|
|
107
105
|
|
|
108
106
|
let substitution;
|
|
109
107
|
|
|
110
|
-
const
|
|
111
|
-
|
|
108
|
+
const termSubstitution = TermSubstitution.fromStatement(statement, context),
|
|
109
|
+
frameSubstitution = FrameSubstitution.fromStatement(statement, context);
|
|
112
110
|
|
|
113
111
|
substitution = (termSubstitution || frameSubstitution);
|
|
114
112
|
|
|
115
113
|
if (substitution !== null) {
|
|
114
|
+
const generalContext = context, ///
|
|
115
|
+
specificContext = context; ///
|
|
116
|
+
|
|
116
117
|
substitution = substitution.validate(generalContext, specificContext); ///
|
|
117
118
|
|
|
118
119
|
if (substitution === null) {
|