occam-verify-cli 1.0.448 → 1.0.457
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 +1 -5
- package/lib/context/file.js +50 -78
- package/lib/context/fragment.js +77 -0
- package/lib/context/release.js +3 -3
- package/lib/context/scoped.js +314 -0
- package/lib/context/transient.js +371 -0
- package/lib/element/assumption.js +71 -84
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +11 -8
- package/lib/element/constructor/bracketed.js +1 -10
- 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 +18 -13
- package/lib/element/frame.js +40 -46
- package/lib/element/judgement.js +35 -56
- package/lib/element/metaType.js +5 -4
- package/lib/element/metavariable.js +6 -6
- package/lib/element/proof.js +4 -4
- package/lib/element/proofAssertion/premise.js +308 -0
- package/lib/element/proofAssertion/step.js +305 -0
- package/lib/element/proofAssertion/supposition.js +322 -0
- package/lib/element/proofAssertion.js +5 -9
- package/lib/element/reference.js +24 -23
- package/lib/element/rule.js +4 -4
- package/lib/element/section.js +4 -4
- package/lib/element/statement.js +2 -7
- package/lib/element/subproof.js +4 -4
- package/lib/element/substitution/frame.js +7 -7
- package/lib/element/substitution/statement.js +15 -39
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +12 -10
- package/lib/element/topLevelAssertion/axiom.js +329 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/element/topLevelAssertion.js +427 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/element/topLevelMetaAssertion.js +289 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +20 -20
- package/lib/metaTypes.js +18 -15
- 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/statement.js +2 -2
- 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 +13 -13
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -9
- package/lib/process/unify.js +7 -6
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/context.js +28 -0
- package/lib/utilities/element.js +101 -99
- package/lib/utilities/fragment.js +23 -0
- package/lib/utilities/instance.js +12 -34
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +42 -21
- package/lib/utilities/unification.js +17 -17
- package/lib/utilities/validation.js +22 -25
- package/package.json +2 -2
- package/src/constants.js +0 -1
- package/src/context/file.js +48 -55
- package/src/context/fragment.js +38 -0
- package/src/context/release.js +4 -2
- package/src/context/{local.js → scoped.js} +8 -100
- package/src/context/{temporary.js → transient.js} +9 -131
- package/src/element/assumption.js +69 -85
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +14 -10
- package/src/element/constructor/bracketed.js +0 -7
- 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 +22 -15
- package/src/element/frame.js +36 -48
- package/src/element/judgement.js +33 -58
- package/src/element/metaType.js +4 -4
- package/src/element/metavariable.js +8 -6
- package/src/element/proof.js +3 -3
- package/src/element/{premise.js → proofAssertion/premise.js} +23 -23
- package/src/element/{step.js → proofAssertion/step.js} +32 -40
- package/src/element/{supposition.js → proofAssertion/supposition.js} +24 -24
- package/src/element/proofAssertion.js +6 -13
- package/src/element/reference.js +23 -21
- package/src/element/rule.js +3 -3
- package/src/element/section.js +4 -4
- package/src/element/statement.js +2 -9
- package/src/element/subproof.js +3 -3
- package/src/element/substitution/frame.js +10 -13
- package/src/element/substitution/statement.js +20 -52
- package/src/element/substitution.js +3 -3
- package/src/element/term.js +10 -9
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +15 -15
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -7
- package/src/element/type.js +2 -4
- package/src/element/variable.js +17 -17
- package/src/metaTypes.js +25 -9
- 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/statement.js +1 -1
- 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 +12 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +31 -32
- package/src/process/unify.js +6 -5
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/context.js +20 -0
- package/src/utilities/element.js +169 -162
- package/src/utilities/fragment.js +11 -0
- package/src/utilities/instance.js +19 -42
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +53 -28
- package/src/utilities/unification.js +16 -16
- package/src/utilities/validation.js +26 -35
- 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/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- 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
package/src/element/deduction.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
|
-
import
|
|
4
|
+
import TransientContext from "../context/transient";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
import { termsFromJSON, framesFromJSON, statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
|
|
@@ -20,9 +20,9 @@ export default define(class Deduction extends Element {
|
|
|
20
20
|
verify(context) {
|
|
21
21
|
let verifies = false;
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const transientContext = TransientContext.fromNothing(context);
|
|
24
24
|
|
|
25
|
-
context =
|
|
25
|
+
context = transientContext; ///
|
|
26
26
|
|
|
27
27
|
const node = this.getNode(),
|
|
28
28
|
deductionString = this.getString(); ///
|
|
@@ -53,14 +53,18 @@ export default define(class Deduction extends Element {
|
|
|
53
53
|
unifyStatement(statement, substitutions, context) {
|
|
54
54
|
let statementUnifies;
|
|
55
55
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
deductionString = deduction.getString();
|
|
56
|
+
const statementString = statement.getString(),
|
|
57
|
+
deductionString = this.getString(); ///
|
|
59
58
|
|
|
60
59
|
context.trace(`Unifying the '${statementString}' statement with the '${deductionString}' deduction...`);
|
|
61
60
|
|
|
62
|
-
const
|
|
63
|
-
|
|
61
|
+
const specificContext = context; ///
|
|
62
|
+
|
|
63
|
+
context = this.getContext();
|
|
64
|
+
|
|
65
|
+
const generalContext = context; ///
|
|
66
|
+
|
|
67
|
+
context = specificContext; ///
|
|
64
68
|
|
|
65
69
|
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
66
70
|
|
|
@@ -72,22 +76,25 @@ export default define(class Deduction extends Element {
|
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
unifyDeduction(deduction, substitutions, generalContext, specificContext) {
|
|
75
|
-
let deductionUnifies;
|
|
79
|
+
let deductionUnifies = false;
|
|
76
80
|
|
|
77
81
|
const context = specificContext, ///
|
|
82
|
+
generalDeduction = this, ///
|
|
78
83
|
specificDeduction = deduction, ///
|
|
79
|
-
generalDeductionString =
|
|
84
|
+
generalDeductionString = generalDeduction.getString(),
|
|
80
85
|
specificDeductionString = specificDeduction.getString();
|
|
81
86
|
|
|
82
|
-
context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction
|
|
87
|
+
context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction...`);
|
|
83
88
|
|
|
84
89
|
const statement = specificDeduction.getStatement(),
|
|
85
90
|
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
86
91
|
|
|
87
|
-
|
|
92
|
+
if (statementUnifies) {
|
|
93
|
+
deductionUnifies = true;
|
|
94
|
+
}
|
|
88
95
|
|
|
89
96
|
if (deductionUnifies) {
|
|
90
|
-
context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction
|
|
97
|
+
context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction.`);
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
return deductionUnifies;
|
|
@@ -127,9 +134,9 @@ export default define(class Deduction extends Element {
|
|
|
127
134
|
statement = statementFromJSON(json, context),
|
|
128
135
|
node = null,
|
|
129
136
|
string = statement.getString(),
|
|
130
|
-
|
|
137
|
+
transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
|
|
131
138
|
|
|
132
|
-
context =
|
|
139
|
+
context = transientContext; ///
|
|
133
140
|
|
|
134
141
|
const deduction = new Deduction(context, string, statement);
|
|
135
142
|
|
package/src/element/frame.js
CHANGED
|
@@ -6,7 +6,6 @@ import Element from "../element";
|
|
|
6
6
|
import elements from "../elements";
|
|
7
7
|
|
|
8
8
|
import { define } from "../elements";
|
|
9
|
-
import { S, NOTHING } from "../constants";
|
|
10
9
|
import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
11
10
|
|
|
12
11
|
const { first } = arrayUtilities;
|
|
@@ -115,7 +114,7 @@ export default define(class Frame extends Element {
|
|
|
115
114
|
compareSubstitutions(substitutions, context) {
|
|
116
115
|
let comparesToSubstitutions;
|
|
117
116
|
|
|
118
|
-
const frameString = this.
|
|
117
|
+
const frameString = this.getString(), ///
|
|
119
118
|
substitutionsString = substitutions.asString();
|
|
120
119
|
|
|
121
120
|
context.trace(`Comparing the '${frameString}' frame to the '${substitutionsString}' substitutions...`);
|
|
@@ -135,114 +134,103 @@ export default define(class Frame extends Element {
|
|
|
135
134
|
return comparesToSubstitutions;
|
|
136
135
|
}
|
|
137
136
|
|
|
138
|
-
|
|
139
|
-
let
|
|
137
|
+
validate(assignments, stated, context) {
|
|
138
|
+
let validates = false;
|
|
140
139
|
|
|
141
|
-
const frameString = this.
|
|
140
|
+
const frameString = this.getString(); ///
|
|
142
141
|
|
|
143
|
-
context.trace(`
|
|
142
|
+
context.trace(`Validating the '${frameString}' frame...`);
|
|
144
143
|
|
|
145
|
-
const
|
|
144
|
+
const assumptionsValidate = this.validateAssumptions(assignments, stated, context);
|
|
146
145
|
|
|
147
|
-
if (
|
|
148
|
-
let
|
|
149
|
-
|
|
146
|
+
if (assumptionsValidate) {
|
|
147
|
+
let validatesWhenStated = false,
|
|
148
|
+
validatesWhenDerived = false;
|
|
150
149
|
|
|
151
150
|
if (stated) {
|
|
152
|
-
|
|
151
|
+
validatesWhenStated = this.validateWhenStated(assignments, context);
|
|
153
152
|
} else {
|
|
154
|
-
|
|
153
|
+
validatesWhenDerived = this.validateWhenDerived(context);
|
|
155
154
|
}
|
|
156
155
|
|
|
157
|
-
if (
|
|
158
|
-
|
|
156
|
+
if (validatesWhenStated || validatesWhenDerived) {
|
|
157
|
+
validates = true;
|
|
159
158
|
}
|
|
160
159
|
}
|
|
161
160
|
|
|
162
|
-
if (
|
|
161
|
+
if (validates) {
|
|
163
162
|
const frame = this; ///
|
|
164
163
|
|
|
165
164
|
context.addFrame(frame);
|
|
166
165
|
|
|
167
|
-
context.debug(`...
|
|
166
|
+
context.debug(`...validated the '${frameString}' frame.`);
|
|
168
167
|
}
|
|
169
168
|
|
|
170
|
-
return
|
|
169
|
+
return validates;
|
|
171
170
|
}
|
|
172
171
|
|
|
173
|
-
|
|
174
|
-
let
|
|
172
|
+
validateWhenStated(assignments, context) {
|
|
173
|
+
let validatesWhenStated = false;
|
|
175
174
|
|
|
176
|
-
const frameString = this.
|
|
175
|
+
const frameString = this.getString(); ///
|
|
177
176
|
|
|
178
|
-
context.trace(`
|
|
177
|
+
context.trace(`Validating the '${frameString}' stated frame...`);
|
|
179
178
|
|
|
180
179
|
const singular = this.isSingular();
|
|
181
180
|
|
|
182
181
|
if (!singular) {
|
|
183
182
|
context.trace(`The '${frameString}' stated frame must be singular.`);
|
|
184
183
|
} else {
|
|
185
|
-
|
|
184
|
+
validatesWhenStated = true;
|
|
186
185
|
}
|
|
187
186
|
|
|
188
|
-
if (
|
|
189
|
-
context.debug(`...
|
|
187
|
+
if (validatesWhenStated) {
|
|
188
|
+
context.debug(`...validated the '${frameString}' stated frame.`);
|
|
190
189
|
}
|
|
191
190
|
|
|
192
|
-
return
|
|
191
|
+
return validatesWhenStated;
|
|
193
192
|
}
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
let
|
|
194
|
+
validateWhenDerived(context) {
|
|
195
|
+
let validatesWhenDerived;
|
|
197
196
|
|
|
198
|
-
const frameString = this.
|
|
197
|
+
const frameString = this.getString(); ///
|
|
199
198
|
|
|
200
199
|
context.trace(`Verifying the '${frameString}' derived frame...`);
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
validatesWhenDerived = true;
|
|
203
202
|
|
|
204
|
-
if (
|
|
203
|
+
if (validatesWhenDerived) {
|
|
205
204
|
context.debug(`...verified the '${frameString}' derived frame.`);
|
|
206
205
|
}
|
|
207
206
|
|
|
208
|
-
return
|
|
207
|
+
return validatesWhenDerived;
|
|
209
208
|
}
|
|
210
209
|
|
|
211
|
-
|
|
212
|
-
let
|
|
210
|
+
validateAssumptions(assignments, stated, context) {
|
|
211
|
+
let assumptionsValidate = true; ///
|
|
213
212
|
|
|
214
213
|
const length = this.getLength();
|
|
215
214
|
|
|
216
215
|
if (length > 0) {
|
|
217
|
-
const sOrNothing = (length > 1) ?
|
|
218
|
-
S :
|
|
219
|
-
NOTHING,
|
|
220
|
-
assumptionsString = assumptionsStringFromAssumptions(this.assumptions);
|
|
221
|
-
|
|
222
|
-
context.trace(`Verifying the '${assumptionsString}' assumption${sOrNothing}...`);
|
|
223
|
-
|
|
224
216
|
stated = true; ///
|
|
225
217
|
|
|
226
218
|
assignments = null; ///
|
|
227
219
|
|
|
228
|
-
|
|
229
|
-
const assumptionVerifies = assumption.
|
|
220
|
+
assumptionsValidate = this.assumptions.every((assumption) => {
|
|
221
|
+
const assumptionVerifies = assumption.validate(assignments, stated, context);
|
|
230
222
|
|
|
231
223
|
return assumptionVerifies;
|
|
232
224
|
});
|
|
233
|
-
|
|
234
|
-
if (assumptionsVerify) {
|
|
235
|
-
context.debug(`...verified the '${assumptionsString}' assumption${sOrNothing}.`);
|
|
236
|
-
}
|
|
237
225
|
}
|
|
238
226
|
|
|
239
|
-
return
|
|
227
|
+
return assumptionsValidate;
|
|
240
228
|
}
|
|
241
229
|
|
|
242
230
|
validateGivenMetaType(metaType, assignments, stated, context) {
|
|
243
231
|
let validatesGivenMetaType = false;
|
|
244
232
|
|
|
245
|
-
const frameString = this.
|
|
233
|
+
const frameString = this.getString(), ///
|
|
246
234
|
metaTypeString = metaType.getString();
|
|
247
235
|
|
|
248
236
|
context.trace(`Validatin the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
|
package/src/element/judgement.js
CHANGED
|
@@ -26,110 +26,85 @@ export default define(class Judgement extends Element {
|
|
|
26
26
|
|
|
27
27
|
getMetavariable() { return this.frame.getMetavariable(); }
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
let
|
|
29
|
+
validate(assignments, stated, context) {
|
|
30
|
+
let validates = false;
|
|
31
31
|
|
|
32
32
|
const judgementString = this.string; ///
|
|
33
33
|
|
|
34
|
-
context.trace(`
|
|
34
|
+
context.trace(`Validating the '${judgementString}' judgement...`);
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const frameValidates = this.frame.validate(assignments, stated, context);
|
|
37
37
|
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
38
|
+
if (frameValidates) {
|
|
39
|
+
const assumptionValidates = this.assumption.validate(assignments, stated, context);
|
|
40
40
|
|
|
41
|
-
if (
|
|
42
|
-
let
|
|
43
|
-
|
|
41
|
+
if (assumptionValidates) {
|
|
42
|
+
let validatesWhenStated = false,
|
|
43
|
+
validatesWhenDerived = false;
|
|
44
44
|
|
|
45
45
|
if (stated) {
|
|
46
|
-
|
|
46
|
+
validatesWhenStated = this.validateWhenStated(assignments, context);
|
|
47
47
|
} else {
|
|
48
|
-
|
|
48
|
+
validatesWhenDerived = this.validateWhenDerived(context);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
if (
|
|
52
|
-
|
|
51
|
+
if (validatesWhenStated || validatesWhenDerived) {
|
|
52
|
+
validates = true;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if (
|
|
57
|
+
if (validates) {
|
|
58
58
|
if (stated) {
|
|
59
59
|
this.assign(assignments, context);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
if (
|
|
64
|
-
context.debug(`...
|
|
63
|
+
if (validates) {
|
|
64
|
+
context.debug(`...validated the '${judgementString}' judgement.`);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
return
|
|
67
|
+
return validates;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
let
|
|
72
|
-
|
|
73
|
-
const frameString = this.frame.getString();
|
|
74
|
-
|
|
75
|
-
context.trace(`Verifying the '${frameString}' frame...`);
|
|
76
|
-
|
|
77
|
-
frameVerifies = this.frame.verify(assignments, stated, context);
|
|
78
|
-
|
|
79
|
-
if (frameVerifies) {
|
|
80
|
-
context.debug(`...verified the '${frameString}' frame.`);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return frameVerifies;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
verifyDeclaration(assignments, stated, context) {
|
|
87
|
-
let declarationVerifies;
|
|
88
|
-
|
|
89
|
-
declarationVerifies = this.assumption.verify(assignments, stated, context);
|
|
90
|
-
|
|
91
|
-
return declarationVerifies;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
verifyWhenStated(assignments, context) {
|
|
95
|
-
let verifiesWhenStated;
|
|
70
|
+
validateWhenStated(assignments, context) {
|
|
71
|
+
let validatesWhenStated;
|
|
96
72
|
|
|
97
73
|
const judgementString = this.string; ///
|
|
98
74
|
|
|
99
|
-
context.trace(`
|
|
75
|
+
context.trace(`Validating the '${judgementString}' stated judgement...`);
|
|
100
76
|
|
|
101
|
-
|
|
77
|
+
validatesWhenStated = true;
|
|
102
78
|
|
|
103
|
-
if (
|
|
104
|
-
context.debug(`...
|
|
79
|
+
if (validatesWhenStated) {
|
|
80
|
+
context.debug(`...validated the '${judgementString}' stated judgement.`);
|
|
105
81
|
}
|
|
106
82
|
|
|
107
|
-
return
|
|
83
|
+
return validatesWhenStated;
|
|
108
84
|
}
|
|
109
85
|
|
|
110
|
-
|
|
111
|
-
let
|
|
86
|
+
validateWhenDerived(context) {
|
|
87
|
+
let validatesWhenDerived = false;
|
|
112
88
|
|
|
113
89
|
const judgementString = this.string; ///
|
|
114
90
|
|
|
115
|
-
context.trace(`
|
|
91
|
+
context.trace(`Validating the '${judgementString}' derived judgement...`);
|
|
116
92
|
|
|
117
93
|
const metavariable = this.assumption.getMetavariable(),
|
|
118
94
|
reference = referenceFromMetavariable(metavariable, context),
|
|
119
|
-
|
|
120
|
-
substitutions =
|
|
95
|
+
topLevelMetaAssertion = context.findTopLevelMetaAssertionByReference(reference),
|
|
96
|
+
substitutions = topLevelMetaAssertion.getSubstitutions(),
|
|
121
97
|
frameComparesToSubstitutions = this.frame.compareSubstitutions(substitutions, context);
|
|
122
98
|
|
|
123
99
|
if (frameComparesToSubstitutions) {
|
|
124
|
-
|
|
125
|
-
|
|
100
|
+
validatesWhenDerived = true;
|
|
126
101
|
}
|
|
127
102
|
|
|
128
|
-
if (
|
|
129
|
-
context.debug(`...
|
|
103
|
+
if (validatesWhenDerived) {
|
|
104
|
+
context.debug(`...validated the '${judgementString}' derived judgement.`);
|
|
130
105
|
}
|
|
131
106
|
|
|
132
|
-
return
|
|
107
|
+
return validatesWhenDerived;
|
|
133
108
|
}
|
|
134
109
|
|
|
135
110
|
assign(assignments, context) {
|
package/src/element/metaType.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import Element from "../element";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
+
import { findMetaTypeFromTypeName } from "../metaTypes";
|
|
6
7
|
|
|
7
8
|
export default define(class MetaType extends Element {
|
|
8
9
|
constructor(context, string, node, name) {
|
|
@@ -41,14 +42,13 @@ export default define(class MetaType extends Element {
|
|
|
41
42
|
static fromJSON(json, context) {
|
|
42
43
|
const { name } = json,
|
|
43
44
|
metaTypeName = name, ///
|
|
44
|
-
metaType =
|
|
45
|
+
metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
45
46
|
|
|
46
47
|
return metaType;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
static fromName(name) {
|
|
50
|
-
const
|
|
51
|
-
string = name,
|
|
50
|
+
static fromName(name, context) {
|
|
51
|
+
const string = name,
|
|
52
52
|
node = null,
|
|
53
53
|
metaType = new MetaType(context, string, node, name);
|
|
54
54
|
|
|
@@ -78,8 +78,8 @@ export default define(class Metavariable extends Element {
|
|
|
78
78
|
validateGivenMetaType(metaType, context) {
|
|
79
79
|
let validatesGivenMetaType = false;
|
|
80
80
|
|
|
81
|
-
const
|
|
82
|
-
|
|
81
|
+
const metaTypeString = metaType.getString(),
|
|
82
|
+
metavariableString = this.getString(); ///
|
|
83
83
|
|
|
84
84
|
context.trace(`Validating the '${metavariableString}' metavariable given the '${metaTypeString}' meta-type...`);
|
|
85
85
|
|
|
@@ -169,15 +169,17 @@ export default define(class Metavariable extends Element {
|
|
|
169
169
|
if (substitutionPresent) {
|
|
170
170
|
substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution); ///
|
|
171
171
|
|
|
172
|
-
const
|
|
172
|
+
const substitutionComparesToStatement = substitution.compareStatement(statement, context);
|
|
173
173
|
|
|
174
|
-
if (
|
|
174
|
+
if (substitutionComparesToStatement) {
|
|
175
175
|
statementUnifies = true;
|
|
176
176
|
}
|
|
177
177
|
} else {
|
|
178
178
|
const { StatementSubstitution } = elements,
|
|
179
179
|
metavariable = this,
|
|
180
|
-
statementSubstitution =
|
|
180
|
+
statementSubstitution = (substitution !== null ) ?
|
|
181
|
+
StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
|
|
182
|
+
StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
181
183
|
|
|
182
184
|
substitution = statementSubstitution; ///
|
|
183
185
|
|
|
@@ -308,7 +310,7 @@ export default define(class Metavariable extends Element {
|
|
|
308
310
|
|
|
309
311
|
if (generalContextFilePath === specificContextFilePath) {
|
|
310
312
|
const metavariable = this, ///
|
|
311
|
-
metavariableString =
|
|
313
|
+
metavariableString = metavariable.getString(),
|
|
312
314
|
statementMetavariableEqualToMetvariable = statement.isMetavariableEqualToMetavariable(metavariable, context);
|
|
313
315
|
|
|
314
316
|
if (statementMetavariableEqualToMetvariable) {
|
package/src/element/proof.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
|
-
import
|
|
4
|
+
import ScopedContext from "../context/scoped";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
|
|
@@ -29,9 +29,9 @@ export default define(class Proof extends Element {
|
|
|
29
29
|
verify(substitutions, conclusion, context) {
|
|
30
30
|
let verifies = false;
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const scopedContext = ScopedContext.fromNothing(context); ///
|
|
33
33
|
|
|
34
|
-
context =
|
|
34
|
+
context = scopedContext; ///
|
|
35
35
|
|
|
36
36
|
const derivationVerifies = this.derivation.verify(substitutions, context);
|
|
37
37
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import ProofAssertion from "
|
|
4
|
-
import
|
|
5
|
-
import assignAssignments from "
|
|
3
|
+
import ProofAssertion from "../proofAssertion";
|
|
4
|
+
import TransientContext from "../../context/transient";
|
|
5
|
+
import assignAssignments from "../../process/assign";
|
|
6
6
|
|
|
7
|
-
import { define } from "
|
|
7
|
+
import { define } from "../../elements";
|
|
8
8
|
import { termsFromJSON,
|
|
9
9
|
framesFromJSON,
|
|
10
10
|
termsToTermsJSON,
|
|
@@ -12,7 +12,7 @@ import { termsFromJSON,
|
|
|
12
12
|
framesToFramesJSON,
|
|
13
13
|
procedureCallFromJSON,
|
|
14
14
|
statementToStatementJSON,
|
|
15
|
-
procedureCallToProcedureCallJSON } from "
|
|
15
|
+
procedureCallToProcedureCallJSON } from "../../utilities/json";
|
|
16
16
|
|
|
17
17
|
export default define(class Premise extends ProofAssertion {
|
|
18
18
|
constructor(context, string, node, statement, procedureCall) {
|
|
@@ -28,9 +28,9 @@ export default define(class Premise extends ProofAssertion {
|
|
|
28
28
|
verify(context) {
|
|
29
29
|
let verifies = false;
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const transientContext = TransientContext.fromNothing(context);
|
|
32
32
|
|
|
33
|
-
context =
|
|
33
|
+
context = transientContext; ///
|
|
34
34
|
|
|
35
35
|
const node = this.getNode(),
|
|
36
36
|
premiseString = this.getString(); ///
|
|
@@ -83,16 +83,15 @@ export default define(class Premise extends ProofAssertion {
|
|
|
83
83
|
unifyIndependently(substitutions, context) {
|
|
84
84
|
let unifiesIndependently = false;
|
|
85
85
|
|
|
86
|
-
const
|
|
87
|
-
premiseString = this.getString(); ///
|
|
86
|
+
const premiseString = this.getString(); ///
|
|
88
87
|
|
|
89
|
-
context.trace(`Unifying the '${premiseString}' premise independently
|
|
88
|
+
context.trace(`Unifying the '${premiseString}' premise independently...`);
|
|
90
89
|
|
|
91
|
-
const
|
|
90
|
+
const specificContext = context; ///
|
|
92
91
|
|
|
93
92
|
context = this.getContext();
|
|
94
93
|
|
|
95
|
-
const
|
|
94
|
+
const generalContext = context; ///
|
|
96
95
|
|
|
97
96
|
context = specificContext; ///
|
|
98
97
|
|
|
@@ -115,7 +114,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
if (unifiesIndependently) {
|
|
118
|
-
context.debug(`...unified the '${premiseString}' premise independenly
|
|
117
|
+
context.debug(`...unified the '${premiseString}' premise independenly.`);
|
|
119
118
|
}
|
|
120
119
|
|
|
121
120
|
return unifiesIndependently;
|
|
@@ -126,8 +125,8 @@ export default define(class Premise extends ProofAssertion {
|
|
|
126
125
|
|
|
127
126
|
const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
|
|
128
127
|
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
subproofOrProofAssertion :
|
|
129
|
+
null,
|
|
131
130
|
subproof = subproofOrProofAssertionProofAssertion ?
|
|
132
131
|
null :
|
|
133
132
|
subproofOrProofAssertion;
|
|
@@ -164,18 +163,19 @@ export default define(class Premise extends ProofAssertion {
|
|
|
164
163
|
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
165
164
|
let proofAssertionUnifies = false;
|
|
166
165
|
|
|
167
|
-
const
|
|
168
|
-
premiseString = this.getString(),
|
|
166
|
+
const premiseString = this.getString(),
|
|
169
167
|
proofAssertionString = proofAssertion.getString();
|
|
170
168
|
|
|
171
|
-
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise
|
|
172
|
-
|
|
173
|
-
const specificContext = context; ///
|
|
169
|
+
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`);
|
|
174
170
|
|
|
175
171
|
context = this.getContext();
|
|
176
172
|
|
|
177
173
|
const generalContext = context; ///
|
|
178
174
|
|
|
175
|
+
context = proofAssertion.getContext();
|
|
176
|
+
|
|
177
|
+
const specificContext = context; ///
|
|
178
|
+
|
|
179
179
|
context = specificContext; ///
|
|
180
180
|
|
|
181
181
|
const statement = proofAssertion.getStatement(),
|
|
@@ -186,7 +186,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
if (proofAssertionUnifies) {
|
|
189
|
-
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise
|
|
189
|
+
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
return proofAssertionUnifies;
|
|
@@ -271,7 +271,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
271
271
|
frames = framesFromJSON(json, context),
|
|
272
272
|
statement = statementFromJSON(json, context),
|
|
273
273
|
procedureCall = procedureCallFromJSON(json, context),
|
|
274
|
-
|
|
274
|
+
transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
|
|
275
275
|
|
|
276
276
|
let string;
|
|
277
277
|
|
|
@@ -285,7 +285,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
285
285
|
|
|
286
286
|
const node = null;
|
|
287
287
|
|
|
288
|
-
context =
|
|
288
|
+
context = transientContext; ///
|
|
289
289
|
|
|
290
290
|
const premise = new Premise(context, string, node, statement, procedureCall);
|
|
291
291
|
|