occam-verify-cli 1.0.448 → 1.0.472
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/constants.js +13 -5
- package/lib/context/ephemeral.js +270 -0
- package/lib/context/file.js +136 -128
- package/lib/context/liminal.js +120 -0
- package/lib/context/literal.js +92 -0
- package/lib/context/nominal.js +15 -1
- package/lib/context/release.js +68 -9
- package/lib/context/scoped.js +322 -0
- package/lib/context/synthetic.js +133 -0
- package/lib/element/assertion/contained.js +66 -66
- package/lib/element/assertion/defined.js +32 -32
- package/lib/element/assertion/property.js +39 -39
- package/lib/element/assertion/satisfies.js +22 -22
- package/lib/element/assumption.js +71 -87
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +19 -15
- package/lib/element/constructor/bracketed.js +1 -10
- package/lib/element/constructor.js +2 -2
- package/lib/element/declaration/combinator.js +1 -2
- package/lib/element/declaration/metavariable.js +3 -3
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +26 -20
- package/lib/element/derivation.js +3 -3
- package/lib/element/equality.js +5 -5
- package/lib/element/equivalence.js +112 -107
- package/lib/element/equivalences.js +24 -10
- package/lib/element/error.js +3 -3
- package/lib/element/frame.js +73 -62
- package/lib/element/hypothesis.js +2 -2
- package/lib/element/judgement.js +40 -60
- package/lib/element/metaType.js +4 -4
- package/lib/element/metavariable.js +49 -38
- package/lib/element/parameter.js +13 -5
- package/lib/element/procedureCall.js +16 -16
- package/lib/element/proof.js +14 -13
- package/lib/element/proofAssertion/premise.js +319 -0
- package/lib/element/proofAssertion/step.js +309 -0
- package/lib/element/proofAssertion/supposition.js +333 -0
- package/lib/element/proofAssertion.js +20 -10
- package/lib/element/propertyRelation.js +2 -2
- package/lib/element/reference.js +72 -30
- package/lib/element/rule.js +26 -28
- package/lib/element/section.js +5 -5
- package/lib/element/signature.js +9 -6
- package/lib/element/statement.js +44 -36
- package/lib/element/subproof.js +18 -17
- package/lib/element/substitution/frame.js +86 -49
- package/lib/element/substitution/reference.js +101 -19
- package/lib/element/substitution/statement.js +128 -105
- package/lib/element/substitution/term.js +93 -57
- package/lib/element/substitution.js +20 -69
- package/lib/element/substitutions.js +49 -34
- package/lib/element/term.js +41 -30
- package/lib/element/topLevelAssertion/axiom.js +331 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +10 -10
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +9 -9
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +8 -8
- package/lib/element/topLevelAssertion.js +434 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +8 -8
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +8 -8
- package/lib/element/topLevelMetaAssertion.js +293 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +48 -40
- package/lib/index.js +3 -3
- package/lib/main.js +3 -3
- package/lib/metaTypes.js +18 -15
- package/lib/node/frame.js +2 -2
- package/lib/node/metavariable.js +4 -4
- package/lib/node/parameter.js +28 -7
- package/lib/node/proofAssertion/premise.js +116 -0
- package/lib/node/proofAssertion/step.js +152 -0
- package/lib/node/proofAssertion/supposition.js +116 -0
- package/lib/node/{premise.js → proofAssertion.js} +11 -18
- package/lib/node/statement.js +2 -2
- package/lib/node/substitution/frame.js +9 -31
- package/lib/node/substitution/reference.js +137 -0
- package/lib/node/substitution/statement.js +9 -31
- package/lib/node/substitution/term.js +9 -23
- package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
- package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
- package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
- package/lib/nonTerminalNodeMap.js +15 -14
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -21
- package/lib/process/unify.js +11 -10
- package/lib/tokenTypes.js +22 -0
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/context.js +63 -0
- package/lib/utilities/element.js +235 -408
- package/lib/utilities/instance.js +12 -34
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +56 -21
- package/lib/utilities/unification.js +38 -32
- package/lib/utilities/validation.js +47 -50
- package/package.json +2 -2
- package/src/constants.js +12 -1
- package/src/context/ephemeral.js +257 -0
- package/src/context/file.js +108 -116
- package/src/context/liminal.js +67 -0
- package/src/context/literal.js +51 -0
- package/src/context/nominal.js +12 -0
- package/src/context/release.js +48 -8
- package/src/context/{local.js → scoped.js} +43 -125
- package/src/context/synthetic.js +60 -0
- package/src/element/assertion/contained.js +49 -47
- package/src/element/assertion/defined.js +29 -27
- package/src/element/assertion/property.js +35 -35
- package/src/element/assertion/satisfies.js +19 -18
- package/src/element/assumption.js +71 -93
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +25 -24
- package/src/element/constructor/bracketed.js +0 -7
- package/src/element/constructor.js +1 -1
- package/src/element/declaration/combinator.js +0 -1
- package/src/element/declaration/metavariable.js +2 -2
- package/src/element/declaration/variable.js +5 -5
- package/src/element/deduction.js +33 -31
- package/src/element/derivation.js +2 -2
- package/src/element/equality.js +4 -4
- package/src/element/equivalence.js +115 -135
- package/src/element/equivalences.js +9 -7
- package/src/element/error.js +4 -2
- package/src/element/frame.js +80 -65
- package/src/element/hypothesis.js +1 -1
- package/src/element/judgement.js +42 -62
- package/src/element/metaType.js +3 -4
- package/src/element/metavariable.js +59 -56
- package/src/element/parameter.js +10 -5
- package/src/element/procedureCall.js +20 -18
- package/src/element/proof.js +14 -16
- package/src/element/{premise.js → proofAssertion/premise.js} +57 -53
- package/src/element/{step.js → proofAssertion/step.js} +59 -62
- package/src/element/{supposition.js → proofAssertion/supposition.js} +67 -56
- package/src/element/proofAssertion.js +24 -13
- package/src/element/propertyRelation.js +1 -1
- package/src/element/reference.js +87 -37
- package/src/element/rule.js +31 -37
- package/src/element/section.js +5 -5
- package/src/element/signature.js +8 -8
- package/src/element/statement.js +52 -48
- package/src/element/subproof.js +16 -18
- package/src/element/substitution/frame.js +104 -50
- package/src/element/substitution/reference.js +120 -20
- package/src/element/substitution/statement.js +169 -130
- package/src/element/substitution/term.js +104 -63
- package/src/element/substitution.js +16 -58
- package/src/element/substitutions.js +43 -41
- package/src/element/term.js +47 -41
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +22 -20
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +5 -6
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +5 -6
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +5 -5
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +37 -33
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +5 -6
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +5 -6
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +19 -17
- package/src/element/type.js +2 -4
- package/src/element/variable.js +47 -48
- package/src/index.js +2 -1
- package/src/main.js +2 -1
- package/src/metaTypes.js +25 -9
- package/src/node/frame.js +1 -1
- package/src/node/metavariable.js +3 -3
- package/src/node/parameter.js +32 -5
- package/src/node/proofAssertion/premise.js +16 -0
- package/src/node/{step.js → proofAssertion/step.js} +4 -18
- package/src/node/proofAssertion/supposition.js +16 -0
- package/src/node/proofAssertion.js +23 -0
- package/src/node/statement.js +1 -1
- package/src/node/substitution/frame.js +6 -32
- package/src/node/substitution/reference.js +38 -0
- package/src/node/substitution/statement.js +6 -32
- package/src/node/substitution/term.js +6 -22
- package/src/node/topLevelAssertion/axiom.js +13 -0
- package/src/node/topLevelAssertion/conjecture.js +13 -0
- package/src/node/topLevelAssertion/lemma.js +13 -0
- package/src/node/topLevelAssertion/theorem.js +13 -0
- package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
- package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
- package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
- package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
- package/src/nonTerminalNodeMap.js +15 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +27 -36
- package/src/process/unify.js +10 -9
- package/src/tokenTypes.js +4 -0
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/context.js +46 -0
- package/src/utilities/element.js +302 -509
- package/src/utilities/instance.js +19 -42
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +69 -28
- package/src/utilities/unification.js +41 -38
- package/src/utilities/validation.js +66 -75
- package/lib/context/local.js +0 -605
- package/lib/context/temporary.js +0 -752
- package/lib/element/axiom.js +0 -329
- package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
- package/lib/element/metaLemmaMetatheorem.js +0 -289
- package/lib/element/premise.js +0 -307
- package/lib/element/step.js +0 -311
- package/lib/element/supposition.js +0 -320
- package/lib/log.js +0 -150
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- package/src/context/temporary.js +0 -476
- package/src/log.js +0 -118
- package/src/node/axiom.js +0 -13
- package/src/node/conjecture.js +0 -13
- package/src/node/lemma.js +0 -13
- package/src/node/metaLemma.js +0 -13
- package/src/node/metatheorem.js +0 -13
- package/src/node/premise.js +0 -30
- package/src/node/supposition.js +0 -30
- package/src/node/theorem.js +0 -13
|
@@ -7,54 +7,12 @@ export default class Substitution extends Element {
|
|
|
7
7
|
super(context, string, node);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
getTerm() {
|
|
11
|
-
const term = null;
|
|
12
|
-
|
|
13
|
-
return term;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
getFrame() {
|
|
17
|
-
const frame = null;
|
|
18
|
-
|
|
19
|
-
return frame;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getVariable() {
|
|
23
|
-
const variable = null;
|
|
24
|
-
|
|
25
|
-
return variable;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getReference() {
|
|
29
|
-
const reference = null;
|
|
30
|
-
|
|
31
|
-
return reference;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getStatement() {
|
|
35
|
-
const statement = null;
|
|
36
|
-
|
|
37
|
-
return statement;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getMetavariable() {
|
|
41
|
-
const metavariableNode = null;
|
|
42
|
-
|
|
43
|
-
return metavariableNode;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
10
|
getSubstitution() {
|
|
47
11
|
const substitution = null;
|
|
48
12
|
|
|
49
13
|
return substitution;
|
|
50
14
|
}
|
|
51
15
|
|
|
52
|
-
getReplacementNode() {
|
|
53
|
-
const replacementNode = null;
|
|
54
|
-
|
|
55
|
-
return replacementNode;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
16
|
isSimple() {
|
|
59
17
|
const simple = true;
|
|
60
18
|
|
|
@@ -74,40 +32,34 @@ export default class Substitution extends Element {
|
|
|
74
32
|
return trivial;
|
|
75
33
|
}
|
|
76
34
|
|
|
77
|
-
isTermEqualToTerm(term, context) {
|
|
78
|
-
const termEqualToTerm = false;
|
|
79
|
-
|
|
80
|
-
return termEqualToTerm;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
35
|
isFrameEqualToFrame(frame) {
|
|
84
36
|
const frameEqualToFrame = false;
|
|
85
37
|
|
|
86
38
|
return frameEqualToFrame;
|
|
87
39
|
}
|
|
88
40
|
|
|
89
|
-
isReferenceEqualToReference(reference
|
|
41
|
+
isReferenceEqualToReference(reference) {
|
|
90
42
|
const referenceEqualToReference = false;
|
|
91
43
|
|
|
92
44
|
return referenceEqualToReference;
|
|
93
45
|
}
|
|
94
46
|
|
|
95
|
-
isStatementEqualToStatement(statement, context) {
|
|
96
|
-
const statementEqualToStatement = false;
|
|
97
|
-
|
|
98
|
-
return statementEqualToStatement;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
47
|
isMetavariableEqualToMetavariable(metavariable) {
|
|
102
48
|
const metavariableEqualToMetavariable = false;
|
|
103
49
|
|
|
104
50
|
return metavariableEqualToMetavariable;
|
|
105
51
|
}
|
|
106
52
|
|
|
107
|
-
|
|
108
|
-
const
|
|
53
|
+
compareTerm(term, context) {
|
|
54
|
+
const comparesToTerm = false;
|
|
55
|
+
|
|
56
|
+
return comparesToTerm;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
compareStatement(statement) {
|
|
60
|
+
const comparesToStatement = false;
|
|
109
61
|
|
|
110
|
-
return
|
|
62
|
+
return comparesToStatement;
|
|
111
63
|
}
|
|
112
64
|
|
|
113
65
|
compareParameter(parameter) {
|
|
@@ -116,6 +68,12 @@ export default class Substitution extends Element {
|
|
|
116
68
|
return comparesToParameter;
|
|
117
69
|
}
|
|
118
70
|
|
|
71
|
+
compareSubstitution(substitution) {
|
|
72
|
+
const comparesToSubstitution = false;
|
|
73
|
+
|
|
74
|
+
return comparesToSubstitution;
|
|
75
|
+
}
|
|
76
|
+
|
|
119
77
|
resolve(substitutions, context) {
|
|
120
78
|
const resolved = true;
|
|
121
79
|
|
|
@@ -8,7 +8,7 @@ import { define } from "../elements";
|
|
|
8
8
|
import { EMPTY_STRING } from "../constants";
|
|
9
9
|
import { substitutionsStringFromSubstitutions } from "../utilities/string";
|
|
10
10
|
|
|
11
|
-
const { find, first, clear, prune, filter, compress, correlate } = arrayUtilities;
|
|
11
|
+
const { find, first, clear, prune, filter, extract, compress, correlate } = arrayUtilities;
|
|
12
12
|
|
|
13
13
|
export default define(class Substitutions extends Element {
|
|
14
14
|
constructor(context, string, node, array, savedArray) {
|
|
@@ -78,7 +78,7 @@ export default define(class Substitutions extends Element {
|
|
|
78
78
|
|
|
79
79
|
mapSubstitution(callback) { return this.array.map(callback); }
|
|
80
80
|
|
|
81
|
-
findSubstitution(callback) { return this.array.find(callback)
|
|
81
|
+
findSubstitution(callback) { return this.array.find(callback) }
|
|
82
82
|
|
|
83
83
|
someSubstitution(callback) { return this.array.some(callback); }
|
|
84
84
|
|
|
@@ -88,9 +88,23 @@ export default define(class Substitutions extends Element {
|
|
|
88
88
|
|
|
89
89
|
forEachSubstitution(callback) { this.array.forEach(callback); }
|
|
90
90
|
|
|
91
|
+
extractSubstitution(callbcak) { return extract(this.array, callbcak); }
|
|
92
|
+
|
|
91
93
|
findSubstitutions(callback) {
|
|
94
|
+
let string;
|
|
95
|
+
|
|
92
96
|
const array = find(this.array, callback),
|
|
93
|
-
|
|
97
|
+
context = null;
|
|
98
|
+
|
|
99
|
+
string = null;
|
|
100
|
+
|
|
101
|
+
const node = null,
|
|
102
|
+
savedArray = [],
|
|
103
|
+
substitutions = new Substitutions(context, string, node, array, savedArray);
|
|
104
|
+
|
|
105
|
+
string = substitutions.asString();
|
|
106
|
+
|
|
107
|
+
substitutions.setString(string);
|
|
94
108
|
|
|
95
109
|
return substitutions;
|
|
96
110
|
}
|
|
@@ -106,7 +120,7 @@ export default define(class Substitutions extends Element {
|
|
|
106
120
|
return true;
|
|
107
121
|
}
|
|
108
122
|
}
|
|
109
|
-
});
|
|
123
|
+
}) || null;
|
|
110
124
|
|
|
111
125
|
return substitution;
|
|
112
126
|
}
|
|
@@ -135,7 +149,7 @@ export default define(class Substitutions extends Element {
|
|
|
135
149
|
return true;
|
|
136
150
|
}
|
|
137
151
|
}
|
|
138
|
-
});
|
|
152
|
+
}) || null;
|
|
139
153
|
|
|
140
154
|
return simpleSubstitution;
|
|
141
155
|
}
|
|
@@ -165,13 +179,13 @@ export default define(class Substitutions extends Element {
|
|
|
165
179
|
|
|
166
180
|
if (substitutionMetavariableEqualToMetavariable) {
|
|
167
181
|
const substitutionB = substitution, ///
|
|
168
|
-
|
|
182
|
+
substitutionBSubstitutionComparesToSubstitutionA = substitutionB.compareSubstitution(substitutionA);
|
|
169
183
|
|
|
170
|
-
if (
|
|
184
|
+
if (substitutionBSubstitutionComparesToSubstitutionA) {
|
|
171
185
|
return true;
|
|
172
186
|
}
|
|
173
187
|
}
|
|
174
|
-
});
|
|
188
|
+
}) || null;
|
|
175
189
|
|
|
176
190
|
return substitution;
|
|
177
191
|
}
|
|
@@ -199,11 +213,12 @@ export default define(class Substitutions extends Element {
|
|
|
199
213
|
}
|
|
200
214
|
|
|
201
215
|
addSubstitution(substitution, context) {
|
|
216
|
+
const substitutionString = substitution.getString(),
|
|
217
|
+
substitutionsString = this.asString(); ///
|
|
218
|
+
|
|
202
219
|
this.array.push(substitution);
|
|
203
220
|
|
|
204
|
-
const string = this.asString()
|
|
205
|
-
substitutionString = substitution.getString(),
|
|
206
|
-
substitutionsString = string; ///
|
|
221
|
+
const string = this.asString();
|
|
207
222
|
|
|
208
223
|
this.setString(string);
|
|
209
224
|
|
|
@@ -295,13 +310,21 @@ export default define(class Substitutions extends Element {
|
|
|
295
310
|
return resolved;
|
|
296
311
|
}
|
|
297
312
|
|
|
298
|
-
snapshot() {
|
|
313
|
+
snapshot(context) {
|
|
314
|
+
const substitutionsString = this.getString(); ///
|
|
315
|
+
|
|
316
|
+
context.trace(`Taking a snapshot of the '${substitutionsString}' substitutions.`);
|
|
317
|
+
|
|
299
318
|
this.savedArray = [
|
|
300
319
|
...this.array
|
|
301
320
|
];
|
|
302
321
|
}
|
|
303
322
|
|
|
304
323
|
rollback(context) {
|
|
324
|
+
const substitutionsString = this.getString(); ///
|
|
325
|
+
|
|
326
|
+
context.trace(`Rolling back the '${substitutionsString}' substitutions.`);
|
|
327
|
+
|
|
305
328
|
const array = [
|
|
306
329
|
...this.array
|
|
307
330
|
];
|
|
@@ -323,7 +346,11 @@ export default define(class Substitutions extends Element {
|
|
|
323
346
|
this.setString(string);
|
|
324
347
|
}
|
|
325
348
|
|
|
326
|
-
continue() {
|
|
349
|
+
continue(context) {
|
|
350
|
+
const substitutionsString = this.getString(); ///
|
|
351
|
+
|
|
352
|
+
context.trace(`Continuing with the '${substitutionsString}' substitutions.`);
|
|
353
|
+
|
|
327
354
|
this.savedArray = null;
|
|
328
355
|
}
|
|
329
356
|
|
|
@@ -344,40 +371,15 @@ export default define(class Substitutions extends Element {
|
|
|
344
371
|
return string;
|
|
345
372
|
}
|
|
346
373
|
|
|
347
|
-
static
|
|
348
|
-
let string;
|
|
349
|
-
|
|
350
|
-
const context = null;
|
|
351
|
-
|
|
352
|
-
string = null;
|
|
353
|
-
|
|
354
|
-
const node = null,
|
|
355
|
-
savedArray = [],
|
|
356
|
-
substitutions = new Substitutions(context, string, node, array, savedArray);
|
|
357
|
-
|
|
358
|
-
string = substitutions.asString();
|
|
359
|
-
|
|
360
|
-
substitutions.setString(string);
|
|
361
|
-
|
|
362
|
-
return substitutions;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
static fromNothing() {
|
|
366
|
-
let string;
|
|
367
|
-
|
|
368
|
-
const context = null;
|
|
369
|
-
|
|
370
|
-
string = null;
|
|
374
|
+
static name = "Substitutions";
|
|
371
375
|
|
|
376
|
+
static fromNothing(context) {
|
|
372
377
|
const node = null,
|
|
378
|
+
string = EMPTY_STRING,
|
|
373
379
|
array = [],
|
|
374
380
|
savedArray = [],
|
|
375
381
|
substitutions = new Substitutions(context, string, node, array, savedArray);
|
|
376
382
|
|
|
377
|
-
string = substitutions.asString();
|
|
378
|
-
|
|
379
|
-
substitutions.setString(string);
|
|
380
|
-
|
|
381
383
|
return substitutions;
|
|
382
384
|
}
|
|
383
385
|
});
|
package/src/element/term.js
CHANGED
|
@@ -6,8 +6,7 @@ import Element from "../element";
|
|
|
6
6
|
|
|
7
7
|
import { define } from "../elements";
|
|
8
8
|
import { validateTerms } from "../utilities/validation";
|
|
9
|
-
import {
|
|
10
|
-
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
9
|
+
import { typeToTypeJSON } from "../utilities/json";
|
|
11
10
|
|
|
12
11
|
const { filter, compress } = arrayUtilities;
|
|
13
12
|
|
|
@@ -26,30 +25,15 @@ export default define(class Term extends Element {
|
|
|
26
25
|
this.type = type;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
isSingular() {
|
|
28
|
+
isSingular() {
|
|
29
|
+
const node = this.getNode(),
|
|
30
|
+
singular = node.isSingular();
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
compareVariable(variable) {
|
|
34
|
-
let comparesToVaraible = false;
|
|
35
|
-
|
|
36
|
-
const singular = this.isSingular();
|
|
37
|
-
|
|
38
|
-
if (singular) {
|
|
39
|
-
const variableNode = variable.getNode(),
|
|
40
|
-
singularVariableNode = this.node.getSingularVariableNode(),
|
|
41
|
-
variableNodeA = variableNode, ///
|
|
42
|
-
variableNodeB = singularVariableNode, ///
|
|
43
|
-
matches = variableNodeA.match(variableNodeB);
|
|
44
|
-
|
|
45
|
-
if (matches) {
|
|
46
|
-
comparesToVaraible = true;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return comparesToVaraible;
|
|
32
|
+
return singular;
|
|
51
33
|
}
|
|
52
34
|
|
|
35
|
+
isProvisional() { return this.type.isProvisional(); }
|
|
36
|
+
|
|
53
37
|
isGrounded(definedVariables, context) {
|
|
54
38
|
const term = this, ///
|
|
55
39
|
variables = variablesFromTerm(term, context);
|
|
@@ -85,10 +69,37 @@ export default define(class Term extends Element {
|
|
|
85
69
|
return implicitlyGrounded;
|
|
86
70
|
}
|
|
87
71
|
|
|
72
|
+
getVariableIdentifier() {
|
|
73
|
+
const node = this.getNode(),
|
|
74
|
+
variableIdentifier = node.getVariableIdentifier();
|
|
75
|
+
|
|
76
|
+
return variableIdentifier;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
compareParameter(parameter) {
|
|
80
|
+
let comparesToParamter = false;
|
|
81
|
+
|
|
82
|
+
const singular = this.isSingular();
|
|
83
|
+
|
|
84
|
+
if (singular) {
|
|
85
|
+
const parameterIdentifier = parameter.getIdentifier();
|
|
86
|
+
|
|
87
|
+
if (parameterIdentifier !== null) {
|
|
88
|
+
const variableIdentifier = this.getVariableIdentifier();
|
|
89
|
+
|
|
90
|
+
if (parameterIdentifier === variableIdentifier) {
|
|
91
|
+
comparesToParamter = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return comparesToParamter;
|
|
97
|
+
}
|
|
98
|
+
|
|
88
99
|
validate(context, verifyAhead) {
|
|
89
100
|
let validates;
|
|
90
101
|
|
|
91
|
-
const termString = this.
|
|
102
|
+
const termString = this.getString(); ///
|
|
92
103
|
|
|
93
104
|
context.trace(`Validating the '${termString}' term...`);
|
|
94
105
|
|
|
@@ -112,16 +123,15 @@ export default define(class Term extends Element {
|
|
|
112
123
|
return validates;
|
|
113
124
|
}
|
|
114
125
|
|
|
115
|
-
|
|
116
|
-
let
|
|
126
|
+
validateGivenType(type, context) {
|
|
127
|
+
let validatesGivenType = false;
|
|
117
128
|
|
|
118
129
|
const typeString = type.getString(),
|
|
119
130
|
termString = this.getString(); ///
|
|
120
131
|
|
|
121
|
-
|
|
132
|
+
context.trace(`Validating the '${termString}' term given the '${typeString}' type...`);
|
|
122
133
|
|
|
123
|
-
const
|
|
124
|
-
validates = this.validate(context, () => {
|
|
134
|
+
const validates = this.validate(context, () => {
|
|
125
135
|
let verifiesAhead;
|
|
126
136
|
|
|
127
137
|
const typeEqualToOrSubTypeOfGivenTypeType = this.type.isEqualToOrSubTypeOf(type);
|
|
@@ -133,18 +143,20 @@ export default define(class Term extends Element {
|
|
|
133
143
|
return verifiesAhead;
|
|
134
144
|
});
|
|
135
145
|
|
|
136
|
-
|
|
146
|
+
if (validates) {
|
|
147
|
+
validatesGivenType = true;
|
|
148
|
+
}
|
|
137
149
|
|
|
138
|
-
if (
|
|
139
|
-
|
|
150
|
+
if (validatesGivenType) {
|
|
151
|
+
context.debug(`...validated the '${termString}' term given the '${typeString}' type.`);
|
|
140
152
|
}
|
|
141
153
|
|
|
142
|
-
return
|
|
154
|
+
return validatesGivenType;
|
|
143
155
|
}
|
|
144
156
|
|
|
145
157
|
toJSON() {
|
|
146
158
|
const typeJSON = typeToTypeJSON(this.type),
|
|
147
|
-
string = this.
|
|
159
|
+
string = this.getString(), ///
|
|
148
160
|
type = typeJSON, ///
|
|
149
161
|
json = {
|
|
150
162
|
type,
|
|
@@ -157,13 +169,7 @@ export default define(class Term extends Element {
|
|
|
157
169
|
static name = "Term";
|
|
158
170
|
|
|
159
171
|
static fromJSON(json, context) {
|
|
160
|
-
|
|
161
|
-
termNode = instantiateTerm(string, context),
|
|
162
|
-
node = termNode, ///
|
|
163
|
-
type = typeFromJSON(json, context),
|
|
164
|
-
term = new Term(context, string, node, type);
|
|
165
|
-
|
|
166
|
-
return term;
|
|
172
|
+
///
|
|
167
173
|
}
|
|
168
174
|
});
|
|
169
175
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "../../node/topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Axiom extends
|
|
7
|
+
export default define(class Axiom extends TopLevelAssertion {
|
|
8
8
|
isSatisfiable() {
|
|
9
9
|
const signature = this.getSignature(),
|
|
10
10
|
satisfiable = (signature !== null);
|
|
@@ -15,10 +15,9 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
15
15
|
verify() {
|
|
16
16
|
let verifies;
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
node = this.getNode(),
|
|
18
|
+
const node = this.getNode(),
|
|
20
19
|
context = this.getContext(),
|
|
21
|
-
axiomString =
|
|
20
|
+
axiomString = this.getString(); ///
|
|
22
21
|
|
|
23
22
|
context.trace(`Verifying the '${axiomString}' axiom...`, node);
|
|
24
23
|
|
|
@@ -225,42 +224,45 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
225
224
|
return lastProofAssertionUnifies;
|
|
226
225
|
}
|
|
227
226
|
|
|
228
|
-
|
|
229
|
-
let
|
|
227
|
+
unifyTopLevelAssertion(topLevelAssertion, substitutions, context) {
|
|
228
|
+
let topLevelAssertionUnifies = false;
|
|
230
229
|
|
|
231
230
|
const node = this.getNode(),
|
|
232
231
|
axiomString = this.getString(),
|
|
233
|
-
|
|
232
|
+
topLevelAssertionString = topLevelAssertion.getString();
|
|
234
233
|
|
|
235
|
-
context.trace(`Unifying the '${
|
|
234
|
+
context.trace(`Unifying the '${topLevelAssertionString}' top level assertion with the '${axiomString}' axiom...`, node);
|
|
236
235
|
|
|
237
|
-
const hypothesesCorrelate =
|
|
236
|
+
const hypothesesCorrelate = topLevelAssertion.correlateHypotheses(context);
|
|
238
237
|
|
|
239
238
|
if (hypothesesCorrelate) {
|
|
240
|
-
const
|
|
241
|
-
specificContext = context; ///
|
|
239
|
+
const specificContext = context; ///
|
|
242
240
|
|
|
243
241
|
context = this.getContext();
|
|
244
242
|
|
|
245
|
-
const generalContext = context
|
|
243
|
+
const generalContext = context; ///
|
|
244
|
+
|
|
245
|
+
context = specificContext; ///
|
|
246
|
+
|
|
247
|
+
const deduction = topLevelAssertion.getDeduction(),
|
|
246
248
|
deductionUnifies = this.unifyDeduction(deduction, substitutions, generalContext, specificContext);
|
|
247
249
|
|
|
248
250
|
if (deductionUnifies) {
|
|
249
|
-
const suppositions =
|
|
251
|
+
const suppositions = topLevelAssertion.getSuppositions(),
|
|
250
252
|
suppositionsUnify = this.unifySuppositions(suppositions, substitutions, generalContext, specificContext);
|
|
251
253
|
|
|
252
|
-
|
|
254
|
+
topLevelAssertionUnifies = suppositionsUnify; ///
|
|
253
255
|
}
|
|
254
256
|
}
|
|
255
257
|
|
|
256
|
-
if (
|
|
257
|
-
context.debug(`...unified the '${
|
|
258
|
+
if (topLevelAssertionUnifies) {
|
|
259
|
+
context.debug(`...unified the '${topLevelAssertionString}' top level assertion with the '${axiomString}' axiom.`, node);
|
|
258
260
|
}
|
|
259
261
|
|
|
260
|
-
return
|
|
262
|
+
return topLevelAssertionUnifies;
|
|
261
263
|
}
|
|
262
264
|
|
|
263
265
|
static name = "Axiom";
|
|
264
266
|
|
|
265
|
-
static fromJSON(json, context) { return
|
|
267
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Axiom, json, context); }
|
|
266
268
|
});
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "../topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Conjecture extends
|
|
7
|
+
export default define(class Conjecture extends TopLevelAssertion {
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
11
11
|
const node = this.getNode(),
|
|
12
12
|
context = this.getContext(),
|
|
13
|
-
|
|
14
|
-
conjectureString = conjecture.getString();
|
|
13
|
+
conjectureString = this.getString(); ///
|
|
15
14
|
|
|
16
15
|
context.trace(`Verifying the '${conjectureString}' conjecture...`, node);
|
|
17
16
|
|
|
@@ -30,5 +29,5 @@ export default define(class Conjecture extends AxiomLemmaTheoremConjecture {
|
|
|
30
29
|
|
|
31
30
|
static name = "Conjecture";
|
|
32
31
|
|
|
33
|
-
static fromJSON(json, context) { return
|
|
32
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Conjecture, json, context); }
|
|
34
33
|
});
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "../topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Lemma extends
|
|
7
|
+
export default define(class Lemma extends TopLevelAssertion {
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
node = this.getNode(),
|
|
11
|
+
const node = this.getNode(),
|
|
13
12
|
context = this.getContext(),
|
|
14
|
-
lemmaString =
|
|
13
|
+
lemmaString = this.getString(); ///
|
|
15
14
|
|
|
16
15
|
(lemmaString === null) ?
|
|
17
16
|
context.trace(`Verifying a lemma...`, node) :
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "../topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Theorem extends
|
|
7
|
+
export default define(class Theorem extends TopLevelAssertion {
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
11
11
|
const node = this.getNode(),
|
|
12
12
|
context = this.getContext(),
|
|
13
|
-
theoremString = this.
|
|
13
|
+
theoremString = this.getString(); ///
|
|
14
14
|
|
|
15
15
|
context.trace(`Verifying the '${theoremString}' theorem...`, node);
|
|
16
16
|
|
|
@@ -29,5 +29,5 @@ export default define(class Theorem extends AxiomLemmaTheoremConjecture {
|
|
|
29
29
|
|
|
30
30
|
static name = "Theorem";
|
|
31
31
|
|
|
32
|
-
static fromJSON(json, context) { return
|
|
32
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Theorem, json, context); }
|
|
33
33
|
});
|