occam-verify-cli 1.0.220 → 1.0.224
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 +19 -19
- package/lib/context/local.js +5 -43
- package/lib/context/release.js +11 -11
- package/lib/dom/assertion/contained.js +44 -44
- package/lib/dom/assertion/defined.js +40 -40
- package/lib/dom/assertion/property.js +37 -35
- package/lib/dom/assertion/satisfies.js +26 -25
- package/lib/dom/assertion/subproof.js +16 -16
- package/lib/dom/assertion/type.js +34 -32
- package/lib/dom/axiom.js +52 -52
- package/lib/dom/combinator/bracketed.js +5 -5
- package/lib/dom/combinator.js +6 -6
- package/lib/dom/conclusion.js +10 -10
- package/lib/dom/conjecture.js +5 -5
- package/lib/dom/constructor/bracketed.js +12 -12
- package/lib/dom/constructor.js +9 -9
- package/lib/dom/declaration/combinator.js +11 -11
- package/lib/dom/declaration/complexType.js +133 -63
- package/lib/dom/declaration/constructor.js +17 -17
- package/lib/dom/declaration/metavariable.js +17 -17
- package/lib/dom/declaration/simpleType.js +229 -0
- package/lib/dom/declaration/variable.js +17 -17
- package/lib/dom/declaration.js +54 -52
- package/lib/dom/deduction.js +15 -15
- package/lib/dom/derivation.js +8 -8
- package/lib/dom/equality.js +49 -34
- package/lib/dom/error.js +3 -3
- package/lib/dom/frame.js +38 -38
- package/lib/dom/judgement.js +31 -29
- package/lib/dom/label.js +5 -5
- package/lib/dom/lemma.js +5 -5
- package/lib/dom/metaLemma.js +5 -5
- package/lib/dom/metatheorem.js +5 -5
- package/lib/dom/metavariable.js +55 -55
- package/lib/dom/premise.js +36 -34
- package/lib/dom/procedureCall.js +9 -9
- package/lib/dom/proof.js +6 -6
- package/lib/dom/propertyRelation.js +18 -18
- package/lib/dom/reference.js +28 -28
- package/lib/dom/rule.js +63 -48
- package/lib/dom/signature.js +17 -17
- package/lib/dom/statement.js +36 -36
- package/lib/dom/step.js +32 -35
- package/lib/dom/subDerivation.js +8 -8
- package/lib/dom/subproof.js +27 -30
- package/lib/dom/substitution/statement.js +7 -7
- package/lib/dom/substitution/term.js +2 -16
- package/lib/dom/substitution.js +1 -15
- package/lib/dom/supposition.js +39 -39
- package/lib/dom/term.js +15 -15
- package/lib/dom/theorem.js +5 -5
- package/lib/dom/topLevelAssertion.js +60 -71
- package/lib/dom/topLevelMetaAssertion.js +28 -20
- package/lib/dom/type.js +18 -24
- package/lib/dom/variable.js +16 -16
- package/lib/equivalence.js +54 -33
- package/lib/equivalences.js +57 -101
- package/lib/index.js +2 -2
- package/lib/mixins/statement/verify.js +52 -52
- package/lib/mixins/step/unify.js +79 -61
- package/lib/mixins/term/verify.js +17 -17
- package/lib/substitutions.js +7 -7
- package/lib/unifier/equantional.js +170 -0
- package/lib/unifier/intrinsicLevel.js +8 -8
- package/lib/unifier/metaLevel.js +21 -21
- package/lib/unifier/metavariable.js +9 -9
- package/lib/unifier/statementWithCombinator.js +18 -18
- package/lib/unifier/termWithConstructor.js +10 -10
- package/lib/unifier.js +41 -41
- package/lib/utilities/brackets.js +2 -2
- package/lib/utilities/release.js +18 -17
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/type.js +2 -2
- package/lib/utilities/unification.js +28 -34
- package/lib/verifier/combinator.js +14 -14
- package/lib/verifier/constructor.js +18 -18
- package/lib/verifier/topLevel.js +38 -38
- package/lib/verifier.js +30 -30
- package/package.json +1 -1
- package/src/context/file.js +18 -18
- package/src/context/local.js +5 -48
- package/src/context/release.js +11 -11
- package/src/dom/assertion/contained.js +46 -46
- package/src/dom/assertion/defined.js +41 -41
- package/src/dom/assertion/property.js +37 -35
- package/src/dom/assertion/satisfies.js +26 -25
- package/src/dom/assertion/subproof.js +15 -15
- package/src/dom/assertion/type.js +34 -32
- package/src/dom/axiom.js +56 -54
- package/src/dom/combinator/bracketed.js +4 -4
- package/src/dom/combinator.js +5 -5
- package/src/dom/conclusion.js +9 -9
- package/src/dom/conjecture.js +4 -4
- package/src/dom/constructor/bracketed.js +11 -11
- package/src/dom/constructor.js +8 -8
- package/src/dom/declaration/combinator.js +10 -10
- package/src/dom/declaration/complexType.js +129 -64
- package/src/dom/declaration/constructor.js +16 -16
- package/src/dom/declaration/metavariable.js +16 -16
- package/src/dom/declaration/simpleType.js +179 -0
- package/src/dom/declaration/variable.js +16 -16
- package/src/dom/declaration.js +54 -52
- package/src/dom/deduction.js +14 -14
- package/src/dom/derivation.js +7 -7
- package/src/dom/equality.js +55 -38
- package/src/dom/error.js +2 -2
- package/src/dom/frame.js +38 -38
- package/src/dom/judgement.js +31 -29
- package/src/dom/label.js +4 -4
- package/src/dom/lemma.js +4 -4
- package/src/dom/metaLemma.js +4 -4
- package/src/dom/metatheorem.js +4 -4
- package/src/dom/metavariable.js +54 -54
- package/src/dom/premise.js +35 -33
- package/src/dom/procedureCall.js +8 -8
- package/src/dom/proof.js +5 -5
- package/src/dom/propertyRelation.js +17 -17
- package/src/dom/reference.js +27 -27
- package/src/dom/rule.js +72 -49
- package/src/dom/signature.js +15 -15
- package/src/dom/statement.js +34 -34
- package/src/dom/step.js +42 -48
- package/src/dom/subDerivation.js +7 -7
- package/src/dom/subproof.js +30 -40
- package/src/dom/substitution/statement.js +6 -6
- package/src/dom/substitution/term.js +1 -19
- package/src/dom/substitution.js +0 -13
- package/src/dom/supposition.js +38 -38
- package/src/dom/term.js +14 -14
- package/src/dom/theorem.js +4 -4
- package/src/dom/topLevelAssertion.js +62 -81
- package/src/dom/topLevelMetaAssertion.js +35 -20
- package/src/dom/type.js +23 -33
- package/src/dom/variable.js +16 -15
- package/src/equivalence.js +69 -46
- package/src/equivalences.js +53 -115
- package/src/index.js +1 -1
- package/src/mixins/statement/verify.js +51 -51
- package/src/mixins/step/unify.js +88 -67
- package/src/mixins/term/verify.js +16 -16
- package/src/substitutions.js +5 -6
- package/src/unifier/equantional.js +90 -0
- package/src/unifier/intrinsicLevel.js +7 -7
- package/src/unifier/metaLevel.js +20 -21
- package/src/unifier/metavariable.js +8 -8
- package/src/unifier/statementWithCombinator.js +17 -17
- package/src/unifier/termWithConstructor.js +9 -9
- package/src/unifier.js +40 -40
- package/src/utilities/brackets.js +1 -1
- package/src/utilities/release.js +18 -18
- package/src/utilities/subproof.js +1 -1
- package/src/utilities/type.js +1 -1
- package/src/utilities/unification.js +27 -37
- package/src/verifier/combinator.js +13 -13
- package/src/verifier/constructor.js +17 -17
- package/src/verifier/topLevel.js +41 -41
- package/src/verifier.js +29 -29
- package/lib/dom/declaration/type.js +0 -209
- package/lib/unifier/equality.js +0 -155
- package/src/dom/declaration/type.js +0 -150
- package/src/unifier/equality.js +0 -70
package/src/equivalence.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
4
|
+
|
|
3
5
|
import { stripBracketsFromTermNode } from "./utilities/brackets";
|
|
4
6
|
|
|
7
|
+
const { compress } = arrayUtilities;
|
|
8
|
+
|
|
5
9
|
export default class Equivalence {
|
|
6
10
|
constructor(terms) {
|
|
7
11
|
this.terms = terms;
|
|
@@ -15,9 +19,23 @@ export default class Equivalence {
|
|
|
15
19
|
const termString = term.getString(),
|
|
16
20
|
equivalenceString = this.asString(); ///
|
|
17
21
|
|
|
18
|
-
context.trace(`Adding the '${termString}' term to the '${equivalenceString}' equivalence
|
|
22
|
+
context.trace(`Adding the '${termString}' term to the '${equivalenceString}' equivalence....`);
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
const termA = term, ///
|
|
25
|
+
termPresent = this.someTerm((term) => {
|
|
26
|
+
const termB = term, ///
|
|
27
|
+
termAEqualToTermB = termA.isEqualTo(termB);
|
|
28
|
+
|
|
29
|
+
if (termAEqualToTermB) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (!termPresent) {
|
|
35
|
+
this.terms.push(term);
|
|
36
|
+
|
|
37
|
+
context.debug(`...added the '${termString}' term to the '${equivalenceString}' equivalence.`);
|
|
38
|
+
}
|
|
21
39
|
}
|
|
22
40
|
|
|
23
41
|
getType() {
|
|
@@ -40,19 +58,6 @@ export default class Equivalence {
|
|
|
40
58
|
return type;
|
|
41
59
|
}
|
|
42
60
|
|
|
43
|
-
matchType(type) {
|
|
44
|
-
const typeA = type; ///
|
|
45
|
-
|
|
46
|
-
type = this.getType();
|
|
47
|
-
|
|
48
|
-
const typeB = type; ///
|
|
49
|
-
|
|
50
|
-
const typeAEqualToTypeB = typeA.isEqualTo(typeB),
|
|
51
|
-
typeMatches = typeAEqualToTypeB; ///
|
|
52
|
-
|
|
53
|
-
return typeMatches;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
61
|
equateTerm(term) {
|
|
57
62
|
const termA = term, ///
|
|
58
63
|
termEquates = this.someTerm((term) => {
|
|
@@ -112,8 +117,45 @@ export default class Equivalence {
|
|
|
112
117
|
return variableNodeMatches;
|
|
113
118
|
}
|
|
114
119
|
|
|
120
|
+
isDisjointFrom(equivalence) {
|
|
121
|
+
const disjointFrom = equivalence.everyTerm((term) => {
|
|
122
|
+
const termEquates = this.equateTerm(term);
|
|
123
|
+
|
|
124
|
+
if (!termEquates) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return disjointFrom;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
mergedWith(equivalence) {
|
|
133
|
+
const equivalenceA = this,
|
|
134
|
+
equivalenceB = equivalence, ///
|
|
135
|
+
equivalenceATerms = equivalenceA.getTerms(),
|
|
136
|
+
equivalenceTermsB = equivalenceB.getTerms(),
|
|
137
|
+
terms = [
|
|
138
|
+
...equivalenceATerms,
|
|
139
|
+
...equivalenceTermsB
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
compress(terms, (termA, termB) => {
|
|
143
|
+
const termAEqualToTermB = termA.isEqualTo(termB);
|
|
144
|
+
|
|
145
|
+
if (termAEqualToTermB) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
equivalence = new Equivalence(terms);
|
|
151
|
+
|
|
152
|
+
return equivalence;
|
|
153
|
+
}
|
|
154
|
+
|
|
115
155
|
someTerm(callback) { return this.terms.some(callback); }
|
|
116
156
|
|
|
157
|
+
everyTerm(callback) { return this.terms.every(callback); }
|
|
158
|
+
|
|
117
159
|
someOtherTerm(term, callback) {
|
|
118
160
|
const termA = term, ///
|
|
119
161
|
terms = this.terms.filter((term) => {
|
|
@@ -201,43 +243,24 @@ export default class Equivalence {
|
|
|
201
243
|
}
|
|
202
244
|
|
|
203
245
|
asString() {
|
|
204
|
-
let string;
|
|
205
|
-
|
|
206
|
-
string = this.terms.reduce((string, term) => {
|
|
207
|
-
const termString = term.getString();
|
|
208
|
-
|
|
209
|
-
string = (string === null) ?
|
|
210
|
-
termString :
|
|
211
|
-
`${string} = ${termString}`;
|
|
212
|
-
|
|
213
|
-
return string;
|
|
214
|
-
}, null);
|
|
215
|
-
|
|
216
246
|
const type = this.getType(),
|
|
217
|
-
typeString = type.getString()
|
|
218
|
-
|
|
219
|
-
|
|
247
|
+
typeString = type.getString(),
|
|
248
|
+
termsString = this.terms.reduce((termsString, term) => {
|
|
249
|
+
const termString = term.getString();
|
|
220
250
|
|
|
221
|
-
|
|
222
|
-
|
|
251
|
+
termsString = (termsString === null) ?
|
|
252
|
+
termString :
|
|
253
|
+
`${termsString} = ${termString}`;
|
|
223
254
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
terms = [
|
|
228
|
-
...leftEquivalenceTerms,
|
|
229
|
-
...rightEquivalenceTerms
|
|
230
|
-
],
|
|
231
|
-
equivalence = new Equivalence(terms);
|
|
255
|
+
return termsString;
|
|
256
|
+
}, null),
|
|
257
|
+
string = `${termsString}:${typeString}`;
|
|
232
258
|
|
|
233
|
-
return
|
|
259
|
+
return string;
|
|
234
260
|
}
|
|
235
261
|
|
|
236
|
-
static
|
|
237
|
-
const terms =
|
|
238
|
-
leftTerm,
|
|
239
|
-
rightTerm
|
|
240
|
-
],
|
|
262
|
+
static fromEquality(equality) {
|
|
263
|
+
const terms = equality.getTerms(),
|
|
241
264
|
equivalence = new Equivalence(terms);
|
|
242
265
|
|
|
243
266
|
return equivalence;
|
package/src/equivalences.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { push, compress, separate } = arrayUtilities;
|
|
5
|
+
const { push, separate } = arrayUtilities;
|
|
8
6
|
|
|
9
7
|
export default class Equivalences {
|
|
10
8
|
constructor(array) {
|
|
@@ -27,51 +25,21 @@ export default class Equivalences {
|
|
|
27
25
|
return types;
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
const array = equivalences.getArray();
|
|
32
|
-
|
|
33
|
-
push(this.array, array);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
forEachEquivalence(callback) { this.array.forEach(callback); }
|
|
37
|
-
|
|
38
|
-
separateEquivalences(equivalencesA, equivalencesB, callback) {
|
|
39
|
-
const arrayA = equivalencesA.getArray(),
|
|
40
|
-
arrayB = equivalencesB.getArray();
|
|
41
|
-
|
|
42
|
-
separate(this.array, arrayA, arrayB, callback);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
addEquivalence(equivalence, context) {
|
|
46
|
-
const equivalenceString = equivalence.asString();
|
|
47
|
-
|
|
48
|
-
context.trace(`Added the '${equivalenceString}' equivalence.`);
|
|
49
|
-
|
|
28
|
+
addEquivalence(equivalence) {
|
|
50
29
|
this.array.push(equivalence);
|
|
51
30
|
}
|
|
52
31
|
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
start = index, ///
|
|
56
|
-
deleteCount = 1,
|
|
57
|
-
equivalenceString = equivalence.asString();
|
|
58
|
-
|
|
59
|
-
context.trace(`Removed the '${equivalenceString}' equivalence.`);
|
|
32
|
+
addEquivalences(equivalences) {
|
|
33
|
+
const array = equivalences.getArray();
|
|
60
34
|
|
|
61
|
-
this.array
|
|
35
|
+
push(this.array, array);
|
|
62
36
|
}
|
|
63
37
|
|
|
64
|
-
|
|
65
|
-
const equivalence = this.array.find((equivalence) => {
|
|
66
|
-
const equivalenceMatchesType = equivalence.matchType(type);
|
|
38
|
+
someEquivalence(callback) { return this.array.some(callback); }
|
|
67
39
|
|
|
68
|
-
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
}) || null;
|
|
40
|
+
everyEquivalence(callback) { return this.array.every(callback); }
|
|
72
41
|
|
|
73
|
-
|
|
74
|
-
}
|
|
42
|
+
forEachEquivalence(callback) { this.array.forEach(callback); }
|
|
75
43
|
|
|
76
44
|
findEquivalenceByTerm(term) {
|
|
77
45
|
const equivalence = this.array.find((equivalence) => {
|
|
@@ -97,6 +65,45 @@ export default class Equivalences {
|
|
|
97
65
|
return equivalence;
|
|
98
66
|
}
|
|
99
67
|
|
|
68
|
+
mergedWith(equivalences) {
|
|
69
|
+
let mergedEquivalences = this.clone(); ///
|
|
70
|
+
|
|
71
|
+
equivalences.forEachEquivalence((equivalence) => {
|
|
72
|
+
mergedEquivalences = mergedEquivalences.mergedWithEquivalence(equivalence);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
return mergedEquivalences;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
mergedWithEquivalence(equivalence) {
|
|
79
|
+
const equivalences = Equivalences.fromNothing();
|
|
80
|
+
|
|
81
|
+
let mergedEquivalence = equivalence; ///
|
|
82
|
+
|
|
83
|
+
this.forEachEquivalence((equivalence) => {
|
|
84
|
+
const mergedEquivalenceDisjointFromEquivalence = mergedEquivalence.isDisjointFrom(equivalence);
|
|
85
|
+
|
|
86
|
+
if (mergedEquivalenceDisjointFromEquivalence) {
|
|
87
|
+
equivalences.addEquivalence(equivalence);
|
|
88
|
+
} else {
|
|
89
|
+
mergedEquivalence = mergedEquivalence.mergedWith(equivalence);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
equivalence = mergedEquivalence; ///
|
|
94
|
+
|
|
95
|
+
equivalences.addEquivalence(equivalence);
|
|
96
|
+
|
|
97
|
+
return equivalences;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
separateEquivalences(equivalencesA, equivalencesB, callback) {
|
|
101
|
+
const equivalencesAArray = equivalencesA.getArray(),
|
|
102
|
+
equivalencesBArray = equivalencesB.getArray();
|
|
103
|
+
|
|
104
|
+
separate(this.array, equivalencesAArray, equivalencesBArray, callback);
|
|
105
|
+
}
|
|
106
|
+
|
|
100
107
|
separateInitiallyGroundedEquivalences(remainingEquivalences, initiallyGroundedEquivalences, context) {
|
|
101
108
|
this.separateEquivalences(remainingEquivalences, initiallyGroundedEquivalences, (equivalence) => {
|
|
102
109
|
const equivalenceInitiallyGrounded = equivalence.isInitiallyGrounded(context);
|
|
@@ -159,48 +166,18 @@ export default class Equivalences {
|
|
|
159
166
|
|
|
160
167
|
equivalences.separateImplicitlyGroundedEquivalences(remainingEquivalences, implicitlyGroundedEquivalences, definedVariables, context);
|
|
161
168
|
|
|
162
|
-
groundedEquivalences.
|
|
169
|
+
groundedEquivalences.addEquivalences(implicitlyGroundedEquivalences);
|
|
163
170
|
|
|
164
171
|
implicitlyGroundedEquivalencesLength = implicitlyGroundedEquivalences.getLength(); ///
|
|
165
172
|
}
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
175
|
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
return substitutionsUnified;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
unifySubstitution(substitution) {
|
|
182
|
-
const substitutionUnified = this.array.some((equivalence) => {
|
|
183
|
-
const substitutionUnifiedWithEquivalence = substitution.unifyWithEquivalence(equivalence);
|
|
184
|
-
|
|
185
|
-
if (substitutionUnifiedWithEquivalence) {
|
|
186
|
-
return true;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
return substitutionUnified;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
mergedWith(equivalences) {
|
|
194
|
-
const equivalencesA = this, ///
|
|
195
|
-
equivalencesB = equivalences;
|
|
196
|
-
|
|
197
|
-
equivalences = mergeEquivalences(equivalencesA, equivalencesB); ///
|
|
198
|
-
|
|
199
|
-
return equivalences;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
static fromArray(array) {
|
|
203
|
-
const equivalences = new Equivalences(array);
|
|
176
|
+
clone() {
|
|
177
|
+
const array = [
|
|
178
|
+
...this.array
|
|
179
|
+
],
|
|
180
|
+
equivalences = new Equivalences(array);
|
|
204
181
|
|
|
205
182
|
return equivalences;
|
|
206
183
|
}
|
|
@@ -213,45 +190,6 @@ export default class Equivalences {
|
|
|
213
190
|
}
|
|
214
191
|
}
|
|
215
192
|
|
|
216
|
-
function mergeEquivalences(equivalencesA, equivalencesB) {
|
|
217
|
-
const typesA = equivalencesA.getTypes(),
|
|
218
|
-
typesB = equivalencesB.getTypes(),
|
|
219
|
-
types = [
|
|
220
|
-
...typesA,
|
|
221
|
-
...typesB
|
|
222
|
-
];
|
|
223
|
-
|
|
224
|
-
compress(types, (typeA, typeB) => {
|
|
225
|
-
if (typeA === typeB) {
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
const array = types.map((type) => {
|
|
231
|
-
let equivalence;
|
|
232
|
-
|
|
233
|
-
const equivalenceA = equivalencesA.findEquivalenceByType(type), ///
|
|
234
|
-
equivalenceB = equivalencesB.findEquivalenceByType(type); ///
|
|
235
|
-
|
|
236
|
-
if ((equivalenceA !== null) && (equivalenceB !== null)) {
|
|
237
|
-
const leftEquivalence = equivalenceA, ///
|
|
238
|
-
rightEquivalence = equivalenceB; ///
|
|
239
|
-
|
|
240
|
-
equivalence = Equivalence.merge(leftEquivalence, rightEquivalence);
|
|
241
|
-
} else if (equivalenceA !== null) {
|
|
242
|
-
equivalence = equivalenceA; ///
|
|
243
|
-
} else if (equivalenceB !== null) {
|
|
244
|
-
equivalence = equivalenceB; ///
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return equivalence;
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
const equivalences = Equivalences.fromArray(array);
|
|
251
|
-
|
|
252
|
-
return equivalences;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
193
|
function definedVariablesFromGroundedTerms(groundedTerms, definedVariables, context) {
|
|
256
194
|
const terms = groundedTerms, ///
|
|
257
195
|
variables = definedVariables; ///
|
package/src/index.js
CHANGED
|
@@ -36,7 +36,6 @@ import Metavariable from "./dom/metavariable";
|
|
|
36
36
|
import ProcedureCall from "./dom/procedureCall";
|
|
37
37
|
import SubDerivation from "./dom/subDerivation";
|
|
38
38
|
import TypeAssertion from "./dom/assertion/type";
|
|
39
|
-
import TypeDeclaration from "./dom/declaration/type";
|
|
40
39
|
import DefinedAssertion from "./dom/assertion/defined";
|
|
41
40
|
import PropertyRelation from "./dom/propertyRelation";
|
|
42
41
|
import TermSubstitution from "./dom/substitution/term";
|
|
@@ -48,6 +47,7 @@ import SatisfiesAssertion from "./dom/assertion/satisfies";
|
|
|
48
47
|
import VariableDeclaration from "./dom/declaration/variable";
|
|
49
48
|
import BracketedCombinator from "./dom/combinator/bracketed";
|
|
50
49
|
import BracketedConstructor from "./dom/constructor/bracketed";
|
|
50
|
+
import SimpleTypeDeclaration from "./dom/declaration/simpleType";
|
|
51
51
|
import ReferenceSubstitution from "./dom/substitution/reference";
|
|
52
52
|
import StatementSubstitution from "./dom/substitution/statement";
|
|
53
53
|
import CombinatorDeclaration from "./dom/declaration/combinator";
|
|
@@ -19,9 +19,9 @@ function unifyWithBracketedCombinator(statement, assignments, stated, context) {
|
|
|
19
19
|
|
|
20
20
|
const { BracketedCombinator } = dom,
|
|
21
21
|
bracketedCombinator = BracketedCombinator.fromNothing(),
|
|
22
|
-
|
|
22
|
+
unifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
|
|
23
23
|
|
|
24
|
-
return
|
|
24
|
+
return unifiesWithBracketedCombinator;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function unifyWithCombinators(statement, assignments, stated, context) {
|
|
@@ -30,19 +30,19 @@ function unifyWithCombinators(statement, assignments, stated, context) {
|
|
|
30
30
|
assignments = null; ///
|
|
31
31
|
|
|
32
32
|
const combinators = context.getCombinators(),
|
|
33
|
-
|
|
34
|
-
const
|
|
33
|
+
unifiesWithCombinators = combinators.some((combinator) => {
|
|
34
|
+
const unifiesWithCombinator = combinator.unifyStatement(statement, assignments, stated, context);
|
|
35
35
|
|
|
36
|
-
if (
|
|
36
|
+
if (unifiesWithCombinator) {
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
return
|
|
41
|
+
return unifiesWithCombinators;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function verifyAsMetavariable(statement, assignments, stated, context) {
|
|
45
|
-
let
|
|
45
|
+
let verifiesAsMetavariable = false;
|
|
46
46
|
|
|
47
47
|
const metavariable = metavariableFromStatement(statement, context);
|
|
48
48
|
|
|
@@ -51,20 +51,20 @@ function verifyAsMetavariable(statement, assignments, stated, context) {
|
|
|
51
51
|
|
|
52
52
|
context.trace(`Verifying the '${statementString}' statement as a metavariable...`);
|
|
53
53
|
|
|
54
|
-
const
|
|
54
|
+
const metavariableVerifies = metavariable.verify(context);
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
verifiesAsMetavariable = metavariableVerifies; ///
|
|
57
57
|
|
|
58
|
-
if (
|
|
58
|
+
if (verifiesAsMetavariable) {
|
|
59
59
|
context.debug(`...verified the '${statementString}' statement as a metavariable.`);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
return
|
|
63
|
+
return verifiesAsMetavariable;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
function verifyAsEquality(statement, assignments, stated, context) {
|
|
67
|
-
let
|
|
67
|
+
let verifiesAsEquality = false;
|
|
68
68
|
|
|
69
69
|
const equality = equalityFromStatement(statement, context);
|
|
70
70
|
|
|
@@ -73,20 +73,20 @@ function verifyAsEquality(statement, assignments, stated, context) {
|
|
|
73
73
|
|
|
74
74
|
context.trace(`Verifying the '${statementString}' statement as an equality...`);
|
|
75
75
|
|
|
76
|
-
const
|
|
76
|
+
const equalityVerifies = equality.verify(assignments, stated, context);
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
verifiesAsEquality = equalityVerifies; ///
|
|
79
79
|
|
|
80
|
-
if (
|
|
80
|
+
if (verifiesAsEquality) {
|
|
81
81
|
context.debug(`...verified the '${statementString}' statement as an equality.`);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
return
|
|
85
|
+
return verifiesAsEquality;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
function verifyAsJudgement(statement, assignments, stated, context) {
|
|
89
|
-
let
|
|
89
|
+
let verifiesAsJudgement = false;
|
|
90
90
|
|
|
91
91
|
const judgement = judgementFromStatement(statement, context);
|
|
92
92
|
|
|
@@ -95,20 +95,20 @@ function verifyAsJudgement(statement, assignments, stated, context) {
|
|
|
95
95
|
|
|
96
96
|
context.trace(`Verifying the '${statementString}' statement as a judgement...`);
|
|
97
97
|
|
|
98
|
-
const
|
|
98
|
+
const judgementVerifies = judgement.verify(assignments, stated, context);
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
verifiesAsJudgement = judgementVerifies; ///
|
|
101
101
|
|
|
102
|
-
if (
|
|
102
|
+
if (verifiesAsJudgement) {
|
|
103
103
|
context.debug(`...verified the '${statementString}' statement as a judgement.`);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
return
|
|
107
|
+
return verifiesAsJudgement;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
function verifyAsTypeAssertion(statement, assignments, stated, context) {
|
|
111
|
-
let
|
|
111
|
+
let verifiesAsTypeAssertion = false;
|
|
112
112
|
|
|
113
113
|
const typeAssertion = typeAssertionFromStatement(statement, context);
|
|
114
114
|
|
|
@@ -117,20 +117,20 @@ function verifyAsTypeAssertion(statement, assignments, stated, context) {
|
|
|
117
117
|
|
|
118
118
|
context.trace(`Verifying the '${statementString}' statement as a type assertion...`);
|
|
119
119
|
|
|
120
|
-
const
|
|
120
|
+
const typeAssertionVerifies = typeAssertion.verify(assignments, stated, context);
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
verifiesAsTypeAssertion = typeAssertionVerifies; ///
|
|
123
123
|
|
|
124
|
-
if (
|
|
124
|
+
if (verifiesAsTypeAssertion) {
|
|
125
125
|
context.debug(`...verified the '${statementString}' statement as a type assertion.`);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
return
|
|
129
|
+
return verifiesAsTypeAssertion;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
function verifyAsDefinedAssertion(statement, assignments, stated, context) {
|
|
133
|
-
let
|
|
133
|
+
let verifiesAsDefinedAssertion = false;
|
|
134
134
|
|
|
135
135
|
const definedAssertion = definedAssertionFromStatement(statement, context);
|
|
136
136
|
|
|
@@ -139,20 +139,20 @@ function verifyAsDefinedAssertion(statement, assignments, stated, context) {
|
|
|
139
139
|
|
|
140
140
|
context.trace(`Verifying the '${statementString}' statement as a defined assertion...`);
|
|
141
141
|
|
|
142
|
-
const
|
|
142
|
+
const definedAssertionVerifies = definedAssertion.verify(assignments, stated, context);
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
verifiesAsDefinedAssertion = definedAssertionVerifies; ///
|
|
145
145
|
|
|
146
|
-
if (
|
|
146
|
+
if (verifiesAsDefinedAssertion) {
|
|
147
147
|
context.debug(`...verified the '${statementString}' statement as a defined assertion.`);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
return
|
|
151
|
+
return verifiesAsDefinedAssertion;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
function verifyAsPropertyAssertion(statement, assignments, stated, context) {
|
|
155
|
-
let
|
|
155
|
+
let verifiesAsPropertyAssertion = false;
|
|
156
156
|
|
|
157
157
|
const propertyAssertion = propertyAssertionFromStatement(statement, context);
|
|
158
158
|
|
|
@@ -161,20 +161,20 @@ function verifyAsPropertyAssertion(statement, assignments, stated, context) {
|
|
|
161
161
|
|
|
162
162
|
context.trace(`Verifying the '${statementString}' statement as a property assertion...`);
|
|
163
163
|
|
|
164
|
-
const
|
|
164
|
+
const propertyAssertionVerifies = propertyAssertion.verify(assignments, stated, context);
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
verifiesAsPropertyAssertion = propertyAssertionVerifies; ///
|
|
167
167
|
|
|
168
|
-
if (
|
|
168
|
+
if (verifiesAsPropertyAssertion) {
|
|
169
169
|
context.debug(`...verified the '${statementString}' statement as a property assertion.`);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
return
|
|
173
|
+
return verifiesAsPropertyAssertion;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
function verifyAsSubproofAssertion(statement, assignments, stated, context) {
|
|
177
|
-
let
|
|
177
|
+
let verifiesAsSubproofAssertion = false;
|
|
178
178
|
|
|
179
179
|
const subproofAssertion = subproofAssertionFromStatement(statement, context);
|
|
180
180
|
|
|
@@ -183,20 +183,20 @@ function verifyAsSubproofAssertion(statement, assignments, stated, context) {
|
|
|
183
183
|
|
|
184
184
|
context.trace(`Verifying the '${statementString}' statement as a subproof assertion...`);
|
|
185
185
|
|
|
186
|
-
const
|
|
186
|
+
const subproofAssertionVerifies = subproofAssertion.verify(assignments, stated, context);
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
verifiesAsSubproofAssertion = subproofAssertionVerifies; ///
|
|
189
189
|
|
|
190
|
-
if (
|
|
190
|
+
if (verifiesAsSubproofAssertion) {
|
|
191
191
|
context.debug(`...verified the '${statementString}' statement as a subproof assertion.`);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
return
|
|
195
|
+
return verifiesAsSubproofAssertion;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
function verifyAsContainedAssertion(statement, assignments, stated, context) {
|
|
199
|
-
let
|
|
199
|
+
let verifiesAsContainedAssertion = false;
|
|
200
200
|
|
|
201
201
|
const containedAssertion = containedAssertionFromStatement(statement, context);
|
|
202
202
|
|
|
@@ -205,20 +205,20 @@ function verifyAsContainedAssertion(statement, assignments, stated, context) {
|
|
|
205
205
|
|
|
206
206
|
context.trace(`Verifying the '${statementString}' statement as a contained assertion...`);
|
|
207
207
|
|
|
208
|
-
const
|
|
208
|
+
const containedAssertionVerifies = containedAssertion.verify(assignments, stated, context);
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
verifiesAsContainedAssertion = containedAssertionVerifies; ///
|
|
211
211
|
|
|
212
|
-
if (
|
|
212
|
+
if (verifiesAsContainedAssertion) {
|
|
213
213
|
context.debug(`...verified the '${statementString}' statement as a contained assertion.`);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
return
|
|
217
|
+
return verifiesAsContainedAssertion;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
function verifyAsSatisfiesAssertion(statement, assignments, stated, context) {
|
|
221
|
-
let
|
|
221
|
+
let verifiesAsSatisfiesAssertion = false;
|
|
222
222
|
|
|
223
223
|
const satisfiesAssertion = satisfiesAssertionFromStatement(statement, context);
|
|
224
224
|
|
|
@@ -227,16 +227,16 @@ function verifyAsSatisfiesAssertion(statement, assignments, stated, context) {
|
|
|
227
227
|
|
|
228
228
|
context.trace(`Verifying the '${statementString}' statement as a satisfies assertion...`);
|
|
229
229
|
|
|
230
|
-
const
|
|
230
|
+
const satisfiesAssertionVerifies = satisfiesAssertion.verify(assignments, stated, context);
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
verifiesAsSatisfiesAssertion = satisfiesAssertionVerifies; ///
|
|
233
233
|
|
|
234
|
-
if (
|
|
234
|
+
if (verifiesAsSatisfiesAssertion) {
|
|
235
235
|
context.debug(`...verified the '${statementString}' statement as a satisfies assertion.`);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
return
|
|
239
|
+
return verifiesAsSatisfiesAssertion;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
const verifyMixins = [
|