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/utilities/string.js
CHANGED
|
@@ -156,6 +156,17 @@ export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conc
|
|
|
156
156
|
return ruleString;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
export function sectionStringFromHypothesesTopLevelAssertion(hypotheses, axiom, lemma, theorem, conjecture, context) {
|
|
160
|
+
const topLevelAssertion = (axiom || lemma || theorem || conjecture),
|
|
161
|
+
topLevelAssertionString = topLevelAssertion.getString(),
|
|
162
|
+
hypothesesString = hypothesesStringFromHypotheses(hypotheses, context),
|
|
163
|
+
sectionString = (topLevelAssertionString !== null) ?
|
|
164
|
+
`[${hypothesesString}]::: ${topLevelAssertionString}` :
|
|
165
|
+
`[${hypothesesString}]::: `;
|
|
166
|
+
|
|
167
|
+
return sectionString;
|
|
168
|
+
}
|
|
169
|
+
|
|
159
170
|
export function subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation) {
|
|
160
171
|
const lastProofAssertion = subDerivation.getLastProofAssertion(),
|
|
161
172
|
suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
@@ -165,6 +176,14 @@ export function subproofStringFromSuppositionsAndSubDerivation(suppositions, sub
|
|
|
165
176
|
return subproofString;
|
|
166
177
|
}
|
|
167
178
|
|
|
179
|
+
export function frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable) {
|
|
180
|
+
const frameString = frame.getString(),
|
|
181
|
+
metavariableString = metavariable.getString(),
|
|
182
|
+
string = `[${frameString} for [${metavariableString}]]`;
|
|
183
|
+
|
|
184
|
+
return string;
|
|
185
|
+
}
|
|
186
|
+
|
|
168
187
|
export function typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes) {
|
|
169
188
|
let typeString;
|
|
170
189
|
|
|
@@ -189,44 +208,50 @@ export function procedureCallStringFromProcedureReferenceAndParameters(procedure
|
|
|
189
208
|
return procedureCallString;
|
|
190
209
|
}
|
|
191
210
|
|
|
192
|
-
export function
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
sectionString = (axiomLemmaTheoremOrConjectureString !== null) ?
|
|
197
|
-
`[${hypothesesString}]::: ${axiomLemmaTheoremOrConjectureString}` :
|
|
198
|
-
`[${hypothesesString}]::: `;
|
|
211
|
+
export function statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable) {
|
|
212
|
+
const statementString = statement.getString(),
|
|
213
|
+
metavariableString = metavariable.getString(),
|
|
214
|
+
statementSubstitutionString = `[${statementString} for ${metavariableString}]`;
|
|
199
215
|
|
|
200
|
-
return
|
|
216
|
+
return statementSubstitutionString;
|
|
201
217
|
}
|
|
202
218
|
|
|
203
|
-
export function
|
|
204
|
-
|
|
205
|
-
deductionString = deduction.getString(),
|
|
206
|
-
labelString = label.getString(),
|
|
207
|
-
metaLemmaMetatheoremString = (suppositionsString !== null) ?
|
|
208
|
-
`${labelString} :: [${suppositionsString}]...${deductionString}` :
|
|
209
|
-
`${labelString} :: ${deductionString}`;
|
|
210
|
-
|
|
211
|
-
return metaLemmaMetatheoremString;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export function axiomLemmaTheoremConjectureStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction) {
|
|
215
|
-
let axiomLemmaTheoremConjectureString;
|
|
219
|
+
export function topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction) {
|
|
220
|
+
let topLevelAssertionString;
|
|
216
221
|
|
|
217
222
|
const suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
218
223
|
deductionString = deduction.getString(),
|
|
219
224
|
labelsString = labelsStringFromLabels(labels);
|
|
220
225
|
|
|
221
226
|
if (labelsString !== null) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
topLevelAssertionString = (suppositionsString !== null) ?
|
|
228
|
+
`${labelsString} :: [${suppositionsString}]...${deductionString}` :
|
|
229
|
+
`${labelsString} :: ${deductionString}`;
|
|
225
230
|
} else {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
topLevelAssertionString = (suppositionsString !== null) ?
|
|
232
|
+
`[${suppositionsString}]...${deductionString}` :
|
|
233
|
+
deductionString;
|
|
229
234
|
}
|
|
230
235
|
|
|
231
|
-
return
|
|
236
|
+
return topLevelAssertionString;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction) {
|
|
240
|
+
const suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
241
|
+
deductionString = deduction.getString(),
|
|
242
|
+
labelString = label.getString(),
|
|
243
|
+
topLevelMetaAssertionString = (suppositionsString !== null) ?
|
|
244
|
+
`${labelString} :: [${suppositionsString}]...${deductionString}` :
|
|
245
|
+
`${labelString} :: ${deductionString}`;
|
|
246
|
+
|
|
247
|
+
return topLevelMetaAssertionString;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution) {
|
|
251
|
+
const statementString = statement.getString(),
|
|
252
|
+
metavariableString = metavariable.getString(),
|
|
253
|
+
substitutionString = substitution.getString(),
|
|
254
|
+
statementSubstitutionString = `[${statementString} for ${metavariableString}${substitutionString}]`;
|
|
255
|
+
|
|
256
|
+
return statementSubstitutionString;
|
|
232
257
|
}
|
|
@@ -96,9 +96,9 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
} else {
|
|
99
|
-
const
|
|
99
|
+
const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
100
100
|
|
|
101
|
-
if (
|
|
101
|
+
if (topLevelAssertion !== null) {
|
|
102
102
|
reference = satisfiesAssertion.getReference();
|
|
103
103
|
|
|
104
104
|
const axiom = context.findAxiomByReference(reference);
|
|
@@ -109,9 +109,9 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
|
|
|
109
109
|
if (satisfiable) {
|
|
110
110
|
const { Substitutions } = elements,
|
|
111
111
|
substitutions = Substitutions.fromNothing(),
|
|
112
|
-
|
|
112
|
+
topLevelAssertionUnifies = axiom.unifyTopLevelAssertion(topLevelAssertion, substitutions, context);
|
|
113
113
|
|
|
114
|
-
if (
|
|
114
|
+
if (topLevelAssertionUnifies) {
|
|
115
115
|
const substitutionsCorrelates = satisfiesAssertion.correlateSubstitutions(substitutions, context);
|
|
116
116
|
|
|
117
117
|
if (substitutionsCorrelates) {
|
|
@@ -135,25 +135,25 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
|
|
|
135
135
|
return statementUnifiesAsSatisfiesAssertion;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
function
|
|
139
|
-
let
|
|
138
|
+
function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAssertion, substitutions, context) {
|
|
139
|
+
let statementUnifiesWithTopLevelAssertion = false;
|
|
140
140
|
|
|
141
141
|
if (reference !== null) {
|
|
142
142
|
const { Substitutions } = elements,
|
|
143
|
-
|
|
143
|
+
topLevelAssertion = context.findTopLevelAssertionByReference(reference),
|
|
144
144
|
generalSubstitutions = substitutions; ///
|
|
145
145
|
|
|
146
|
-
if (
|
|
146
|
+
if (topLevelAssertion !== null) {
|
|
147
147
|
const statementString = statement.getString(),
|
|
148
|
-
|
|
148
|
+
topLevelAssertionString = reference.getString();
|
|
149
149
|
|
|
150
|
-
context.trace(`Unifying the '${statementString}' statement with the '${
|
|
150
|
+
context.trace(`Unifying the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion...`);
|
|
151
151
|
|
|
152
152
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
153
153
|
|
|
154
154
|
substitutions = Substitutions.fromNothing();
|
|
155
155
|
|
|
156
|
-
const statementAndSubproofOrProofAssertionsUnify =
|
|
156
|
+
const statementAndSubproofOrProofAssertionsUnify = topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, substitutions, context);
|
|
157
157
|
|
|
158
158
|
if (statementAndSubproofOrProofAssertionsUnify) {
|
|
159
159
|
const { StatementSubstitution } = elements,
|
|
@@ -165,16 +165,16 @@ function unifyStatementWithAxiomLemmaTheoremOrConjecture(statement, reference, s
|
|
|
165
165
|
|
|
166
166
|
substitutions.addSubstitution(substitution, context);
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
statementUnifiesWithTopLevelAssertion = true;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
if (
|
|
172
|
-
context.debug(`...unified the '${statementString}' statement with the '${
|
|
171
|
+
if (statementUnifiesWithTopLevelAssertion) {
|
|
172
|
+
context.debug(`...unified the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion.`);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
return
|
|
177
|
+
return statementUnifiesWithTopLevelAssertion;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
function unifyStatementAEquality(statement, reference, satisfiesAssertion, substitutions, context) {
|
|
@@ -334,7 +334,7 @@ export const unifyStatements = [
|
|
|
334
334
|
unifyStatementWithRule,
|
|
335
335
|
unifyStatementWithReference,
|
|
336
336
|
unifyStatementAsSatisfiesAssertion,
|
|
337
|
-
|
|
337
|
+
unifyStatementWithTopLevelAssertion,
|
|
338
338
|
unifyStatementAEquality,
|
|
339
339
|
unifyStatementAsJudgement,
|
|
340
340
|
unifyStatementAsTypeAssertion,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import elements from "../elements";
|
|
4
4
|
|
|
5
|
+
import { bracketedConstructorFromNothing, bracketedCombinatorFromNothing } from "../utilities/instance";
|
|
5
6
|
import { equalityFromStatement,
|
|
6
7
|
judgementFromStatement,
|
|
7
|
-
metavariableFromStatement,
|
|
8
8
|
typeAssertionFromStatement,
|
|
9
9
|
definedAssertionFromStatement,
|
|
10
10
|
propertyAssertionFromStatement,
|
|
@@ -15,8 +15,7 @@ import { equalityFromStatement,
|
|
|
15
15
|
function unifyTermWithBracketedConstructor(term, context, validateAhead) {
|
|
16
16
|
let termUnifiesWithBracketedConstructor;
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
bracketedConstructor = BracketedConstructor.fromNothing();
|
|
18
|
+
const bracketedConstructor = bracketedConstructorFromNothing();
|
|
20
19
|
|
|
21
20
|
termUnifiesWithBracketedConstructor = bracketedConstructor.unifyTerm(term, context, validateAhead);
|
|
22
21
|
|
|
@@ -42,40 +41,31 @@ function unifyTermWithConstructors(term, context, validateAhead) {
|
|
|
42
41
|
function validateTermAsVariable(term, context, validateAhead) {
|
|
43
42
|
let termValidatesAsVariable = false;
|
|
44
43
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
singularVariableNode = termNode.getSingularVariableNode();
|
|
44
|
+
const termNode = term.getNode(),
|
|
45
|
+
variableNode = termNode.getVariableNode();
|
|
48
46
|
|
|
49
|
-
if (
|
|
50
|
-
|
|
47
|
+
if (variableNode !== null) {
|
|
48
|
+
const termString = term.getString();
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
variableNode = singularVariableNode; ///
|
|
50
|
+
context.trace(`Validating the '${termString}' term as a variable...`);
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
context.trace(`Verifying the '${termString}' term as a variable...`);
|
|
58
|
-
|
|
59
|
-
const variableValidates = variable.validate(context);
|
|
60
|
-
|
|
61
|
-
if (variableValidates) {
|
|
62
|
-
let verifiesAhead;
|
|
63
|
-
|
|
64
|
-
const variableIdentifier = variable.getIdentifier();
|
|
65
|
-
|
|
66
|
-
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
52
|
+
const variableIdentifier = variableNode.getVariableIdentifier(),
|
|
53
|
+
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
67
54
|
|
|
55
|
+
if (variable !== null) {
|
|
68
56
|
const type = variable.getType();
|
|
69
57
|
|
|
70
58
|
term.setType(type);
|
|
71
59
|
|
|
72
|
-
verifiesAhead = validateAhead();
|
|
60
|
+
const verifiesAhead = validateAhead();
|
|
73
61
|
|
|
74
|
-
|
|
62
|
+
if (verifiesAhead) {
|
|
63
|
+
termValidatesAsVariable = true;
|
|
64
|
+
}
|
|
75
65
|
}
|
|
76
66
|
|
|
77
67
|
if (termValidatesAsVariable) {
|
|
78
|
-
context.debug(`...
|
|
68
|
+
context.debug(`...validated the '${termString}' term as a variable.`);
|
|
79
69
|
}
|
|
80
70
|
}
|
|
81
71
|
|
|
@@ -85,16 +75,20 @@ function validateTermAsVariable(term, context, validateAhead) {
|
|
|
85
75
|
function validateStatementAsMetavariableAndSubstitution(statement, assignments, stated, context) {
|
|
86
76
|
let statementValidatesAsMetavariableAndSubstitution = false;
|
|
87
77
|
|
|
88
|
-
const
|
|
78
|
+
const statementNode = statement.getNode(),
|
|
79
|
+
metavariableNode = statementNode.getMetavariableNode();
|
|
89
80
|
|
|
90
|
-
if (
|
|
81
|
+
if (metavariableNode !== null) {
|
|
91
82
|
const statementString = statement.getString();
|
|
92
83
|
|
|
93
84
|
context.trace(`Validating the '${statementString}' statement as a metavariable and substitution...`);
|
|
94
85
|
|
|
95
|
-
const
|
|
86
|
+
const metavariableName = metavariableNode.getMetavariableName(),
|
|
87
|
+
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
88
|
+
|
|
89
|
+
if (metavariable !== null) {
|
|
90
|
+
statementValidatesAsMetavariableAndSubstitution = true;
|
|
96
91
|
|
|
97
|
-
if (metavariableValidates) {
|
|
98
92
|
const { TermSubstitution, FrameSubstitution } = elements,
|
|
99
93
|
frameSubstitution = FrameSubstitution.fromStatement(statement, context),
|
|
100
94
|
termSubstitution = TermSubstitution.fromStatement(statement, context),
|
|
@@ -103,11 +97,9 @@ function validateStatementAsMetavariableAndSubstitution(statement, assignments,
|
|
|
103
97
|
if (substitution !== null) {
|
|
104
98
|
const substitutionValidates = substitution.validate(context);
|
|
105
99
|
|
|
106
|
-
if (substitutionValidates) {
|
|
107
|
-
statementValidatesAsMetavariableAndSubstitution =
|
|
100
|
+
if (!substitutionValidates) {
|
|
101
|
+
statementValidatesAsMetavariableAndSubstitution = false;
|
|
108
102
|
}
|
|
109
|
-
} else {
|
|
110
|
-
statementValidatesAsMetavariableAndSubstitution = true;
|
|
111
103
|
}
|
|
112
104
|
}
|
|
113
105
|
|
|
@@ -124,8 +116,7 @@ function unifyStatementWithBracketedCombinator(statement, assignments, stated, c
|
|
|
124
116
|
|
|
125
117
|
assignments = null; ///
|
|
126
118
|
|
|
127
|
-
const
|
|
128
|
-
bracketedCombinator = BracketedCombinator.fromNothing(),
|
|
119
|
+
const bracketedCombinator = bracketedCombinatorFromNothing(),
|
|
129
120
|
statementUnifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
|
|
130
121
|
|
|
131
122
|
return statementUnifiesWithBracketedCombinator;
|