occam-verify-cli 0.0.1246 → 0.0.1248
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.js +170 -209
- package/lib/context/local.js +95 -125
- package/lib/dom/assertion/contained.js +44 -22
- package/lib/dom/assertion/defined.js +34 -17
- package/lib/dom/combinator/bracketed.js +167 -0
- package/lib/dom/combinator.js +163 -0
- package/lib/{constructor → dom/constructor}/bracketed.js +7 -7
- package/lib/dom/constructor.js +190 -0
- package/lib/dom/declaration/combinator.js +2 -8
- package/lib/dom/declaration/constructor.js +42 -7
- package/lib/dom/declaration.js +141 -149
- package/lib/dom/equality.js +3 -3
- package/lib/dom/frame.js +111 -76
- package/lib/dom/judgement.js +29 -3
- package/lib/dom/label.js +22 -15
- package/lib/dom/metaLemma.js +13 -58
- package/lib/dom/metatheorem.js +11 -117
- package/lib/dom/metavariable.js +7 -7
- package/lib/dom/reference.js +60 -18
- package/lib/dom/rule.js +6 -7
- package/lib/dom/statement.js +2 -2
- package/lib/dom/term.js +2 -2
- package/lib/dom/topLevelAssertion.js +78 -99
- package/lib/dom/topLevelMetaAssertion.js +253 -0
- package/lib/dom/type.js +3 -3
- package/lib/dom/variable.js +5 -5
- package/lib/equivalence.js +2 -2
- package/lib/index.js +7 -3
- package/lib/mixins/statement/verify.js +3 -3
- package/lib/mixins/term/verify.js +2 -3
- package/lib/substitution/statement.js +2 -2
- package/lib/unifier/{label.js → reference.js} +14 -14
- package/lib/utilities/json.js +5 -7
- package/lib/utilities/string.js +3 -3
- package/lib/utilities/unification.js +25 -6
- package/lib/verifier/combinator.js +3 -3
- package/lib/verifier/constructor.js +3 -3
- package/package.json +5 -5
- package/src/context/file.js +161 -205
- package/src/context/local.js +73 -83
- package/src/dom/assertion/contained.js +60 -27
- package/src/dom/assertion/defined.js +44 -20
- package/src/{combinator → dom/combinator}/bracketed.js +6 -5
- package/src/{combinator.js → dom/combinator.js} +8 -7
- package/src/{constructor → dom/constructor}/bracketed.js +6 -5
- package/src/{constructor.js → dom/constructor.js} +28 -27
- package/src/dom/declaration/combinator.js +2 -3
- package/src/dom/declaration/constructor.js +3 -2
- package/src/dom/declaration.js +163 -199
- package/src/dom/equality.js +2 -2
- package/src/dom/frame.js +151 -95
- package/src/dom/judgement.js +36 -2
- package/src/dom/label.js +18 -13
- package/src/dom/metaLemma.js +5 -78
- package/src/dom/metatheorem.js +8 -121
- package/src/dom/metavariable.js +6 -6
- package/src/dom/reference.js +85 -25
- package/src/dom/rule.js +7 -5
- package/src/dom/statement.js +1 -1
- package/src/dom/term.js +1 -1
- package/src/dom/topLevelAssertion.js +86 -128
- package/src/dom/topLevelMetaAssertion.js +154 -0
- package/src/dom/type.js +2 -2
- package/src/dom/variable.js +4 -4
- package/src/equivalence.js +1 -1
- package/src/index.js +4 -0
- package/src/mixins/statement/verify.js +3 -2
- package/src/mixins/term/verify.js +2 -3
- package/src/substitution/statement.js +1 -1
- package/src/unifier/{label.js → reference.js} +6 -6
- package/src/utilities/json.js +4 -4
- package/src/utilities/string.js +2 -2
- package/src/utilities/unification.js +44 -5
- package/src/verifier/combinator.js +2 -2
- package/src/verifier/constructor.js +2 -2
- package/lib/combinator/bracketed.js +0 -126
- package/lib/combinator.js +0 -122
- package/lib/constructor.js +0 -149
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
5
|
+
import dom from "../dom";
|
|
6
|
+
import LocalContext from "../context/local";
|
|
7
|
+
import Substitutions from "../substitutions";
|
|
8
|
+
import TopLevelAssertion from "./topLevelAssertion";
|
|
9
|
+
|
|
10
|
+
import { nodeQuery } from "../utilities/query";
|
|
11
|
+
import { proofFromNode, consequentFromNode, suppositionsFromNode, labelsStringFromLabels } from "./topLevelAssertion";
|
|
12
|
+
import { labelsFromJSON,
|
|
13
|
+
labelsToLabelsJSON,
|
|
14
|
+
consequentFromJSON,
|
|
15
|
+
suppositionsFromJSON,
|
|
16
|
+
substitutionsFromJSON,
|
|
17
|
+
consequentToConsequentJSON,
|
|
18
|
+
suppositionsToSuppositionsJSON,
|
|
19
|
+
substitutionsToSubstitutionsJSON } from "../utilities/json";
|
|
20
|
+
|
|
21
|
+
const { first } = arrayUtilities;
|
|
22
|
+
|
|
23
|
+
const labelNodeQuery = nodeQuery("/metatheorem/label");
|
|
24
|
+
|
|
25
|
+
export default class TopLevelMetaAssertion extends TopLevelAssertion {
|
|
26
|
+
constructor(fileContext, string, labels, suppositions, consequent, proof, substitutions) {
|
|
27
|
+
super(fileContext, string, labels, suppositions, consequent, proof);
|
|
28
|
+
|
|
29
|
+
this.substitutions = substitutions;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getSubstitutions() {
|
|
33
|
+
return this.substitutions;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getLabel() {
|
|
37
|
+
const labels = this.getLabels(),
|
|
38
|
+
firstLabel = first(labels),
|
|
39
|
+
label = firstLabel; ///
|
|
40
|
+
|
|
41
|
+
return label;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
verify() {
|
|
45
|
+
let verified = false;
|
|
46
|
+
|
|
47
|
+
const labelsVerified = this.verifyLabels();
|
|
48
|
+
|
|
49
|
+
if (labelsVerified) {
|
|
50
|
+
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
51
|
+
context = localContext, ///
|
|
52
|
+
suppositionsVerified = this.suppositions.every((supposition) => {
|
|
53
|
+
const suppositionVerified = supposition.verify(context);
|
|
54
|
+
|
|
55
|
+
if (suppositionVerified) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (suppositionsVerified) {
|
|
61
|
+
const consequentVerified = this.consequent.verify(context);
|
|
62
|
+
|
|
63
|
+
if (consequentVerified) {
|
|
64
|
+
if (this.proof === null) {
|
|
65
|
+
verified = true;
|
|
66
|
+
} else {
|
|
67
|
+
const proofVerified = this.proof.verify(this.substitutions, this.consequent, context);
|
|
68
|
+
|
|
69
|
+
verified = proofVerified; ///
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return verified;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
verifyLabels() {
|
|
79
|
+
const labelsVerified = this.labels.every((label) => {
|
|
80
|
+
const nameOnly = false,
|
|
81
|
+
labelVerified = label.verify(nameOnly);
|
|
82
|
+
|
|
83
|
+
if (labelVerified) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return labelsVerified;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
verifyWhenStated(statement, reference, context) {
|
|
92
|
+
let verifiedWhenStated;
|
|
93
|
+
|
|
94
|
+
debugger
|
|
95
|
+
|
|
96
|
+
return verifiedWhenStated;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
toJSON() {
|
|
100
|
+
const labelsJSON = labelsToLabelsJSON(this.labels),
|
|
101
|
+
consequentJSON = consequentToConsequentJSON(this.consequent),
|
|
102
|
+
suppositionsJSON = suppositionsToSuppositionsJSON(this.suppositions),
|
|
103
|
+
substitutionsJSON = substitutionsToSubstitutionsJSON(this.substitutions),
|
|
104
|
+
labels = labelsJSON, ///
|
|
105
|
+
consequent = consequentJSON, ///
|
|
106
|
+
suppositions = suppositionsJSON, ///
|
|
107
|
+
substitutions = substitutionsJSON, ///
|
|
108
|
+
json = {
|
|
109
|
+
labels,
|
|
110
|
+
consequent,
|
|
111
|
+
suppositions,
|
|
112
|
+
substitutions
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return json;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static fromJSON(Class, json, fileContext) {
|
|
119
|
+
const labels = labelsFromJSON(json, fileContext),
|
|
120
|
+
substitutions = substitutionsFromJSON(json, fileContext),
|
|
121
|
+
labelsString = labelsStringFromLabels(labels),
|
|
122
|
+
suppositions = suppositionsFromJSON(json, fileContext),
|
|
123
|
+
consequent = consequentFromJSON(json, fileContext),
|
|
124
|
+
proof = null,
|
|
125
|
+
string = labelsString, ///
|
|
126
|
+
topLevelAssertion = new Class(fileContext, string, labels, suppositions, consequent, proof, substitutions);
|
|
127
|
+
|
|
128
|
+
return topLevelAssertion;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static fromNode(Class, node, fileContext) {
|
|
132
|
+
const labels = labelsFromNode(node, fileContext),
|
|
133
|
+
substitutions = Substitutions.fromNothing(),
|
|
134
|
+
labelsString = labelsStringFromLabels(labels),
|
|
135
|
+
suppositions = suppositionsFromNode(node, fileContext),
|
|
136
|
+
consequent = consequentFromNode(node, fileContext),
|
|
137
|
+
proof = proofFromNode(node, fileContext),
|
|
138
|
+
string = labelsString, ///
|
|
139
|
+
metaLemma = new Class(fileContext, string, labels, suppositions, consequent, proof, substitutions);
|
|
140
|
+
|
|
141
|
+
return metaLemma;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function labelsFromNode(node, fileContext) {
|
|
146
|
+
const { Label } = dom,
|
|
147
|
+
labelNode = labelNodeQuery(node),
|
|
148
|
+
label = Label.fromLabelNode(labelNode, fileContext),
|
|
149
|
+
labels = [
|
|
150
|
+
label
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
return labels;
|
|
154
|
+
}
|
package/src/dom/type.js
CHANGED
|
@@ -110,9 +110,9 @@ class Type {
|
|
|
110
110
|
|
|
111
111
|
fileContext.trace(`Verifying the '${typeString}' type when declared...`);
|
|
112
112
|
|
|
113
|
-
const
|
|
113
|
+
const typePresent = fileContext.isTypePresentByTypeName(this.name);
|
|
114
114
|
|
|
115
|
-
if (
|
|
115
|
+
if (typePresent) {
|
|
116
116
|
fileContext.debug(`The type '${typeString}' has already been declared.`);
|
|
117
117
|
} else {
|
|
118
118
|
const superTypeName = this.superType.getName(),
|
package/src/dom/variable.js
CHANGED
|
@@ -142,15 +142,15 @@ export default domAssigned(class Variable {
|
|
|
142
142
|
fileContext.trace(`Verifying the '${variableString}' variable when declared...`);
|
|
143
143
|
|
|
144
144
|
const variableName = this.name, ///
|
|
145
|
-
|
|
145
|
+
variablePresent = fileContext.isVariablePresentByVariableName(variableName);
|
|
146
146
|
|
|
147
|
-
if (
|
|
147
|
+
if (variablePresent) {
|
|
148
148
|
fileContext.debug(`The '${variableName}' variable has already been declared.`);
|
|
149
149
|
} else {
|
|
150
150
|
const metavariableName = this.name, ///
|
|
151
|
-
|
|
151
|
+
metavariablePresent = fileContext.isMetavariablePresentByMetavariableName(metavariableName);
|
|
152
152
|
|
|
153
|
-
if (
|
|
153
|
+
if (metavariablePresent) {
|
|
154
154
|
fileContext.debug(`A '${metavariableName}' variable has already been declared.`);
|
|
155
155
|
} else {
|
|
156
156
|
const typeVerified = this.verifyType(fileContext);
|
package/src/equivalence.js
CHANGED
|
@@ -16,7 +16,7 @@ export default class Equivalence {
|
|
|
16
16
|
|
|
17
17
|
addTerm(term, context) {
|
|
18
18
|
const termString = term.getString(),
|
|
19
|
-
equivalenceString = this.getString();
|
|
19
|
+
equivalenceString = this.getString(); ///
|
|
20
20
|
|
|
21
21
|
context.trace(`Adding the '${termString}' term to the '${equivalenceString}' equivalence.`);
|
|
22
22
|
|
package/src/index.js
CHANGED
|
@@ -25,6 +25,8 @@ import Consequent from "./dom/consequent";
|
|
|
25
25
|
import Conjecture from "./dom/conjecture";
|
|
26
26
|
import Conclusion from "./dom/conclusion";
|
|
27
27
|
import Derivation from "./dom/derivation";
|
|
28
|
+
import Combinator from "./dom/combinator";
|
|
29
|
+
import Constructor from "./dom/constructor";
|
|
28
30
|
import Declaration from "./dom/declaration";
|
|
29
31
|
import Supposition from "./dom/supposition";
|
|
30
32
|
import Metatheorem from "./dom/metatheorem";
|
|
@@ -37,6 +39,8 @@ import DefinedAssertion from "./dom/assertion/defined";
|
|
|
37
39
|
import SubproofAssertion from "./dom/assertion/subproof";
|
|
38
40
|
import ContainedAssertion from "./dom/assertion/contained";
|
|
39
41
|
import VariableDeclaration from "./dom/declaration/variable";
|
|
42
|
+
import BracketedCombinator from "./dom/combinator/bracketed";
|
|
43
|
+
import BracketedConstructor from "./dom/constructor/bracketed";
|
|
40
44
|
import CombinatorDeclaration from "./dom/declaration/combinator";
|
|
41
45
|
import ConstructorDeclaration from "./dom/declaration/constructor";
|
|
42
46
|
import MetavariableDeclaration from "./dom/declaration/metavariable";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../../dom";
|
|
4
4
|
|
|
5
5
|
import { equalityFromStatement,
|
|
6
6
|
judgementFromStatement,
|
|
@@ -169,7 +169,8 @@ function unifyWithBracketedCombinator(statement, assignments, stated, context) {
|
|
|
169
169
|
|
|
170
170
|
assignments = null; ///
|
|
171
171
|
|
|
172
|
-
const
|
|
172
|
+
const { BracketedCombinator } = dom,
|
|
173
|
+
bracketedCombinator = BracketedCombinator.fromNothing(),
|
|
173
174
|
unifiedWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
|
|
174
175
|
|
|
175
176
|
return unifiedWithBracketedCombinator;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
4
|
|
|
5
|
-
import BracketedConstructor from "../../constructor/bracketed";
|
|
6
|
-
|
|
7
5
|
import { nodeQuery } from "../../utilities/query";
|
|
8
6
|
|
|
9
7
|
const variableNodeQuery = nodeQuery("/term/variable!");
|
|
@@ -47,7 +45,8 @@ function verifyTermAsVariable(term, localContext, verifyAhead) {
|
|
|
47
45
|
function unifyWithBracketedConstructor(term, context, verifyAhead) {
|
|
48
46
|
let unifiedWithBracketedConstructor;
|
|
49
47
|
|
|
50
|
-
const
|
|
48
|
+
const { BracketedConstructor } = dom,
|
|
49
|
+
bracketedConstructor = BracketedConstructor.fromNothing();
|
|
51
50
|
|
|
52
51
|
unifiedWithBracketedConstructor = bracketedConstructor.unifyTerm(term, context, verifyAhead);
|
|
53
52
|
|
|
@@ -78,7 +78,7 @@ export default class StatementSubstitution extends Substitution {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
resolve(substitutions, generalContext, specificContext) {
|
|
81
|
-
const substitutionString = this.string;
|
|
81
|
+
const substitutionString = this.string; ///
|
|
82
82
|
|
|
83
83
|
const metavariable = this.getMetavariable(),
|
|
84
84
|
simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable);
|
|
@@ -8,17 +8,17 @@ import { nodeQuery } from "../utilities/query";
|
|
|
8
8
|
const termNodeQuery = nodeQuery("/term"),
|
|
9
9
|
termVariableNodeQuery = nodeQuery("/term/variable!");
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class ReferenceUnifier extends Unifier {
|
|
12
12
|
unify(labelMetavariableNode, referenceMetavariableNode, substitutions, generalContext, specificContext) {
|
|
13
|
-
let
|
|
13
|
+
let referenceUnified;
|
|
14
14
|
|
|
15
15
|
const generalNonTerminalNode = labelMetavariableNode, ///
|
|
16
16
|
specificNonTerminalNode = referenceMetavariableNode, ///
|
|
17
17
|
nonTerminalNodeUnified = this.unifyNonTerminalNode(generalNonTerminalNode, specificNonTerminalNode, substitutions, generalContext, specificContext);
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
referenceUnified = nonTerminalNodeUnified; ///
|
|
20
20
|
|
|
21
|
-
return
|
|
21
|
+
return referenceUnified;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
static maps = [
|
|
@@ -51,6 +51,6 @@ class LabelUnifier extends Unifier {
|
|
|
51
51
|
];
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const
|
|
54
|
+
const referenceUnified = new ReferenceUnifier();
|
|
55
55
|
|
|
56
|
-
export default
|
|
56
|
+
export default referenceUnified;
|
package/src/utilities/json.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
|
-
import Combinator from "../combinator";
|
|
5
|
-
import Constructor from "../constructor";
|
|
6
4
|
import StatementSubstitution from "../substitution/statement";
|
|
7
5
|
|
|
8
6
|
export function termFromJSON(json, fileContext) {
|
|
@@ -287,7 +285,8 @@ export function conjecturesFromJSON(json, fileContext) {
|
|
|
287
285
|
export function combinatorsFromJSON(json, fileContext) {
|
|
288
286
|
let { combinators } = json;
|
|
289
287
|
|
|
290
|
-
const
|
|
288
|
+
const { Combinator } = dom,
|
|
289
|
+
combinatorsJSON = combinators; ///
|
|
291
290
|
|
|
292
291
|
combinators = combinatorsJSON.map((combinatorJSON) => {
|
|
293
292
|
const json = combinatorJSON, ///
|
|
@@ -302,7 +301,8 @@ export function combinatorsFromJSON(json, fileContext) {
|
|
|
302
301
|
export function constructorsFromJSON(json, fileContext) {
|
|
303
302
|
let { constructors } = json;
|
|
304
303
|
|
|
305
|
-
const
|
|
304
|
+
const { Constructor } = dom,
|
|
305
|
+
constructorsJSON = constructors; ///
|
|
306
306
|
|
|
307
307
|
constructors = constructorsJSON.map((constructorJSON) => {
|
|
308
308
|
const json = constructorJSON, ///
|
package/src/utilities/string.js
CHANGED
|
@@ -18,12 +18,12 @@ export function nodesAsString(nodes, tokens) {
|
|
|
18
18
|
const string = nodes.reduce((string, node) => {
|
|
19
19
|
const nodeString = nodeAsString(node, tokens);
|
|
20
20
|
|
|
21
|
-
string = (string ===
|
|
21
|
+
string = (string === null) ?
|
|
22
22
|
nodeString :
|
|
23
23
|
`${string},${nodeString}`;
|
|
24
24
|
|
|
25
25
|
return string;
|
|
26
|
-
},
|
|
26
|
+
}, null);
|
|
27
27
|
|
|
28
28
|
return string;
|
|
29
29
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use string";
|
|
2
2
|
|
|
3
3
|
import LocalContext from "../context/local";
|
|
4
|
-
import
|
|
4
|
+
import Substitutions from "../substitutions";
|
|
5
5
|
import equalityUnifier from "../unifier/equality";
|
|
6
|
+
import referenceUnifier from "../unifier/reference";
|
|
6
7
|
import metaLevelUnifier from "../unifier/metaLevel";
|
|
7
8
|
import metavariableUnifier from "../unifier/metavariable";
|
|
8
9
|
import intrinsicLevelUnifier from "../unifier/intrinsicLevel";
|
|
@@ -81,27 +82,65 @@ export function unifyMetavariable(generalMetavariable, specificMetavariable, gen
|
|
|
81
82
|
return metavariableUnified;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
export function unifyLabelWithReference(label, reference,
|
|
85
|
+
export function unifyLabelWithReference(label, reference, context) {
|
|
85
86
|
let labelUnifiedWithReference;
|
|
86
87
|
|
|
87
|
-
|
|
88
|
+
let generalContext,
|
|
89
|
+
specificContext;
|
|
90
|
+
|
|
91
|
+
const fileContext = label.getFileContext(),
|
|
92
|
+
labelMetavariable = label.getMetavariable(),
|
|
88
93
|
referenceMetavariable = reference.getMetavariable(),
|
|
89
94
|
labelMetavariableNode = labelMetavariable.getNode(),
|
|
90
95
|
labelMetavariableTokens = labelMetavariable.getTokens(),
|
|
91
96
|
referenceMetavariableNode = referenceMetavariable.getNode(),
|
|
92
97
|
referenceMetavariableTokens = referenceMetavariable.getTokens();
|
|
93
98
|
|
|
99
|
+
generalContext = context; ///
|
|
100
|
+
|
|
101
|
+
specificContext = fileContext; ///
|
|
102
|
+
|
|
94
103
|
generalContext = contextFromTokens(labelMetavariableTokens, generalContext); ///
|
|
95
104
|
|
|
96
105
|
specificContext = contextFromTokens(referenceMetavariableTokens, specificContext); ///
|
|
97
106
|
|
|
98
|
-
const
|
|
107
|
+
const substitutions = Substitutions.fromNothing(),
|
|
108
|
+
referenceUnified = referenceUnifier.unify(labelMetavariableNode, referenceMetavariableNode, substitutions, generalContext, specificContext);
|
|
99
109
|
|
|
100
|
-
labelUnifiedWithReference =
|
|
110
|
+
labelUnifiedWithReference = referenceUnified; ///
|
|
101
111
|
|
|
102
112
|
return labelUnifiedWithReference;
|
|
103
113
|
}
|
|
104
114
|
|
|
115
|
+
export function unifyMetavariableWithReference(metavariable, reference, context) {
|
|
116
|
+
let metavariableUnifiedWithReference;
|
|
117
|
+
|
|
118
|
+
let generalContext,
|
|
119
|
+
specificContext;
|
|
120
|
+
|
|
121
|
+
const fileContext = context.getFileContext(),
|
|
122
|
+
metavariableNode = metavariable.getNode(),
|
|
123
|
+
metavariableTokens = metavariable.getTokens(),
|
|
124
|
+
referenceMetavariable = reference.getMetavariable(),
|
|
125
|
+
referenceMetavariableNode = referenceMetavariable.getNode(),
|
|
126
|
+
referenceMetavariableTokens = referenceMetavariable.getTokens();
|
|
127
|
+
|
|
128
|
+
generalContext = context; ///
|
|
129
|
+
|
|
130
|
+
specificContext = fileContext; ///
|
|
131
|
+
|
|
132
|
+
generalContext = contextFromTokens(metavariableTokens, generalContext); ///
|
|
133
|
+
|
|
134
|
+
specificContext = contextFromTokens(referenceMetavariableTokens, specificContext); ///
|
|
135
|
+
|
|
136
|
+
const substitutions = Substitutions.fromNothing(),
|
|
137
|
+
referenceUnified = referenceUnifier.unify(metavariableNode, referenceMetavariableNode, substitutions, generalContext, specificContext);
|
|
138
|
+
|
|
139
|
+
metavariableUnifiedWithReference = referenceUnified; ///
|
|
140
|
+
|
|
141
|
+
return metavariableUnifiedWithReference;
|
|
142
|
+
}
|
|
143
|
+
|
|
105
144
|
export function unifyTermWithConstructor(term, constructor, context) {
|
|
106
145
|
let termUnifiedWithConstructor;
|
|
107
146
|
|
|
@@ -61,9 +61,9 @@ class CombinatorVerifier extends Verifier {
|
|
|
61
61
|
let typeVerified = false;
|
|
62
62
|
|
|
63
63
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
64
|
-
|
|
64
|
+
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
65
65
|
|
|
66
|
-
if (
|
|
66
|
+
if (typePresent) {
|
|
67
67
|
typeVerified = true;
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -46,9 +46,9 @@ class ConstructorVerifier extends Verifier {
|
|
|
46
46
|
let typeVerified = false;
|
|
47
47
|
|
|
48
48
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
49
|
-
|
|
49
|
+
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
50
50
|
|
|
51
|
-
if (
|
|
51
|
+
if (typePresent) {
|
|
52
52
|
const verifiedAhead = verifyAhead();
|
|
53
53
|
|
|
54
54
|
if (verifiedAhead) {
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return BracketedCombinator;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _dom = /*#__PURE__*/ _interop_require_default(require("../dom"));
|
|
12
|
-
var _combinator = /*#__PURE__*/ _interop_require_default(require("../combinator"));
|
|
13
|
-
var _combinator1 = /*#__PURE__*/ _interop_require_default(require("../context/bracketed/combinator"));
|
|
14
|
-
var _unification = require("../utilities/unification");
|
|
15
|
-
function _assert_this_initialized(self) {
|
|
16
|
-
if (self === void 0) {
|
|
17
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
18
|
-
}
|
|
19
|
-
return self;
|
|
20
|
-
}
|
|
21
|
-
function _call_super(_this, derived, args) {
|
|
22
|
-
derived = _get_prototype_of(derived);
|
|
23
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
24
|
-
}
|
|
25
|
-
function _class_call_check(instance, Constructor) {
|
|
26
|
-
if (!(instance instanceof Constructor)) {
|
|
27
|
-
throw new TypeError("Cannot call a class as a function");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function _defineProperties(target, props) {
|
|
31
|
-
for(var i = 0; i < props.length; i++){
|
|
32
|
-
var descriptor = props[i];
|
|
33
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
34
|
-
descriptor.configurable = true;
|
|
35
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
36
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
40
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
41
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
42
|
-
return Constructor;
|
|
43
|
-
}
|
|
44
|
-
function _get_prototype_of(o) {
|
|
45
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
46
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
47
|
-
};
|
|
48
|
-
return _get_prototype_of(o);
|
|
49
|
-
}
|
|
50
|
-
function _inherits(subClass, superClass) {
|
|
51
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
52
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
53
|
-
}
|
|
54
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
55
|
-
constructor: {
|
|
56
|
-
value: subClass,
|
|
57
|
-
writable: true,
|
|
58
|
-
configurable: true
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
62
|
-
}
|
|
63
|
-
function _interop_require_default(obj) {
|
|
64
|
-
return obj && obj.__esModule ? obj : {
|
|
65
|
-
default: obj
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function _possible_constructor_return(self, call) {
|
|
69
|
-
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
70
|
-
return call;
|
|
71
|
-
}
|
|
72
|
-
return _assert_this_initialized(self);
|
|
73
|
-
}
|
|
74
|
-
function _set_prototype_of(o, p) {
|
|
75
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
76
|
-
o.__proto__ = p;
|
|
77
|
-
return o;
|
|
78
|
-
};
|
|
79
|
-
return _set_prototype_of(o, p);
|
|
80
|
-
}
|
|
81
|
-
function _type_of(obj) {
|
|
82
|
-
"@swc/helpers - typeof";
|
|
83
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
84
|
-
}
|
|
85
|
-
function _is_native_reflect_construct() {
|
|
86
|
-
try {
|
|
87
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
88
|
-
} catch (_) {}
|
|
89
|
-
return (_is_native_reflect_construct = function() {
|
|
90
|
-
return !!result;
|
|
91
|
-
})();
|
|
92
|
-
}
|
|
93
|
-
var BracketedCombinator = /*#__PURE__*/ function(Combinator) {
|
|
94
|
-
_inherits(BracketedCombinator, Combinator);
|
|
95
|
-
function BracketedCombinator() {
|
|
96
|
-
_class_call_check(this, BracketedCombinator);
|
|
97
|
-
return _call_super(this, BracketedCombinator, arguments);
|
|
98
|
-
}
|
|
99
|
-
_create_class(BracketedCombinator, [
|
|
100
|
-
{
|
|
101
|
-
key: "unifyStatement",
|
|
102
|
-
value: function unifyStatement(statement, assignments, stated, context) {
|
|
103
|
-
var statementUnified;
|
|
104
|
-
var statementString = statement.getString();
|
|
105
|
-
context.trace("Unifying the '".concat(statementString, "' statement with the bracketed combinator..."));
|
|
106
|
-
var bracketedCombinator = this, combinator = bracketedCombinator, statementUnifiedWithCombinator = (0, _unification.unifyStatementWithCombinator)(statement, combinator, assignments, stated, context);
|
|
107
|
-
statementUnified = statementUnifiedWithCombinator;
|
|
108
|
-
if (statementUnified) {
|
|
109
|
-
context.debug("...unified the '".concat(statementString, "' statement with the bracketed combinator."));
|
|
110
|
-
}
|
|
111
|
-
return statementUnified;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
], [
|
|
115
|
-
{
|
|
116
|
-
key: "fromNothing",
|
|
117
|
-
value: function fromNothing() {
|
|
118
|
-
var Statement = _dom.default.Statement, bracketedStatementNode = _combinator1.default.getBracketedStatementNode(), statementNode = bracketedStatementNode, context = _combinator1.default, statement = Statement.fromStatementNode(statementNode, context), bracketedCombinator = new BracketedCombinator(statement);
|
|
119
|
-
return bracketedCombinator;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
]);
|
|
123
|
-
return BracketedCombinator;
|
|
124
|
-
}(_combinator.default);
|
|
125
|
-
|
|
126
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21iaW5hdG9yL2JyYWNrZXRlZC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IGRvbSBmcm9tIFwiLi4vZG9tXCI7XG5pbXBvcnQgQ29tYmluYXRvciBmcm9tIFwiLi4vY29tYmluYXRvclwiO1xuaW1wb3J0IGNvbWJpbmF0b3JCcmFja2V0ZWRDb250ZXh0IGZyb20gXCIuLi9jb250ZXh0L2JyYWNrZXRlZC9jb21iaW5hdG9yXCI7XG5cbmltcG9ydCB7IHVuaWZ5U3RhdGVtZW50V2l0aENvbWJpbmF0b3IgfSBmcm9tIFwiLi4vdXRpbGl0aWVzL3VuaWZpY2F0aW9uXCI7XG5cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIEJyYWNrZXRlZENvbWJpbmF0b3IgZXh0ZW5kcyBDb21iaW5hdG9yIHtcbiAgdW5pZnlTdGF0ZW1lbnQoc3RhdGVtZW50LCBhc3NpZ25tZW50cywgc3RhdGVkLCBjb250ZXh0KSB7XG4gICAgbGV0IHN0YXRlbWVudFVuaWZpZWQ7XG5cbiAgICBjb25zdCBzdGF0ZW1lbnRTdHJpbmcgPSBzdGF0ZW1lbnQuZ2V0U3RyaW5nKCk7XG5cbiAgICBjb250ZXh0LnRyYWNlKGBVbmlmeWluZyB0aGUgJyR7c3RhdGVtZW50U3RyaW5nfScgc3RhdGVtZW50I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