occam-verify-cli 1.0.444 → 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 +54 -82
- package/lib/context/fragment.js +77 -0
- package/lib/context/release.js +5 -9
- 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/derivation.js +14 -14
- package/lib/element/frame.js +40 -46
- package/lib/element/hypothesis.js +14 -55
- package/lib/element/judgement.js +35 -56
- package/lib/element/metaType.js +5 -4
- package/lib/element/metavariable.js +14 -10
- package/lib/element/proof.js +10 -10
- 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 +199 -0
- package/lib/element/reference.js +28 -25
- package/lib/element/rule.js +29 -29
- package/lib/element/section.js +4 -4
- package/lib/element/statement.js +9 -14
- package/lib/element/subDerivation.js +14 -14
- package/lib/element/subproof.js +14 -14
- 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 +33 -19
- 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/subDerivation.js +1 -8
- package/lib/node/subproof.js +1 -8
- 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/brackets.js +6 -11
- 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 -21
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +44 -23
- package/lib/utilities/unification.js +36 -36
- package/lib/utilities/validation.js +22 -25
- package/package.json +6 -6
- package/src/constants.js +0 -1
- package/src/context/file.js +51 -58
- package/src/context/fragment.js +38 -0
- package/src/context/release.js +6 -11
- package/src/context/{local.js → scoped.js} +35 -127
- 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/derivation.js +12 -12
- package/src/element/frame.js +36 -48
- package/src/element/hypothesis.js +14 -16
- package/src/element/judgement.js +33 -58
- package/src/element/metaType.js +4 -4
- package/src/element/metavariable.js +17 -10
- package/src/element/proof.js +9 -9
- package/src/element/{premise.js → proofAssertion/premise.js} +107 -75
- package/src/element/{step.js → proofAssertion/step.js} +43 -89
- package/src/element/{supposition.js → proofAssertion/supposition.js} +89 -88
- package/src/element/proofAssertion.js +69 -0
- package/src/element/reference.js +27 -23
- package/src/element/rule.js +25 -25
- package/src/element/section.js +4 -4
- package/src/element/statement.js +8 -15
- package/src/element/subDerivation.js +12 -12
- package/src/element/subproof.js +10 -10
- 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} +41 -41
- 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} +30 -49
- 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 -72
- package/src/element/type.js +2 -4
- package/src/element/variable.js +17 -17
- package/src/metaTypes.js +42 -13
- 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/subDerivation.js +0 -7
- package/src/node/subproof.js +0 -7
- 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/brackets.js +5 -8
- 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 -24
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +57 -32
- package/src/utilities/unification.js +39 -39
- 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 -434
- package/lib/element/metaLemmaMetatheorem.js +0 -322
- package/lib/element/premise.js +0 -380
- package/lib/element/step.js +0 -390
- package/lib/element/supposition.js +0 -410
- 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
|
@@ -150,21 +150,40 @@ export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conc
|
|
|
150
150
|
conclusionString = conclusion.getString(),
|
|
151
151
|
labelsString = labelsStringFromLabels(labels),
|
|
152
152
|
ruleString = (premisesString !== null) ?
|
|
153
|
-
`${labelsString} :: [${premisesString}]
|
|
153
|
+
`${labelsString} :: [${premisesString}]...${conclusionString}` :
|
|
154
154
|
`${labelsString} :: ${conclusionString}`;
|
|
155
155
|
|
|
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
|
-
const
|
|
161
|
-
lastStepString = lastStep.getString(),
|
|
171
|
+
const lastProofAssertion = subDerivation.getLastProofAssertion(),
|
|
162
172
|
suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
163
|
-
|
|
173
|
+
lastProofAssertionString = lastProofAssertion.getString(),
|
|
174
|
+
subproofString = `[${suppositionsString}]...${lastProofAssertionString}`;
|
|
164
175
|
|
|
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
|
}
|
|
@@ -24,10 +24,10 @@ function unifyStatementWithRule(statement, reference, satisfiesAssertion, substi
|
|
|
24
24
|
|
|
25
25
|
context.trace(`Unifying the '${statementString}' statement with the '${ruleString}' rule...`);
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
28
|
+
statementAndSubproofOrProofAssertionsUnify = rule.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
|
|
29
29
|
|
|
30
|
-
if (
|
|
30
|
+
if (statementAndSubproofOrProofAssertionsUnify) {
|
|
31
31
|
statementUnifiesWithRule = true;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -44,14 +44,14 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
|
|
|
44
44
|
let statementUnifiesWithReference = false;
|
|
45
45
|
|
|
46
46
|
if (reference !== null) {
|
|
47
|
-
const
|
|
47
|
+
const statementString = statement.getString(),
|
|
48
|
+
referenceString = reference.getString();
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
const statementString = statement.getString(),
|
|
51
|
-
referenceString = reference.getString();
|
|
50
|
+
context.trace(`Unifying the '${statementString}' statement with the '${referenceString}' reference...`);
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
const metavariableValidates = reference.validateMetavariable(context);
|
|
54
53
|
|
|
54
|
+
if (metavariableValidates) {
|
|
55
55
|
const { StatementSubstitution } = elements,
|
|
56
56
|
metavariable = reference.getMetavariable(),
|
|
57
57
|
statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
|
|
@@ -60,10 +60,10 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
|
|
|
60
60
|
substitutions.addSubstitution(substitution, context);
|
|
61
61
|
|
|
62
62
|
statementUnifiesWithReference = true;
|
|
63
|
+
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
65
|
+
if (statementUnifiesWithReference) {
|
|
66
|
+
context.debug(`...unified the '${statementString}' statement with the '${referenceString}' reference.`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -86,9 +86,9 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
|
|
|
86
86
|
satisfiesAssertion.verifySignature(assignments, stated, context);
|
|
87
87
|
|
|
88
88
|
if (reference === null) {
|
|
89
|
-
const
|
|
89
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
90
90
|
|
|
91
|
-
statementUnifiesAsSatisfiesAssertion = backwardsSome(
|
|
91
|
+
statementUnifiesAsSatisfiesAssertion = backwardsSome(subproofOrProofAssertions, (stepsOrSubproof) => {
|
|
92
92
|
const stepOrSubProofUnifiesWIthSatisfiesAssertion = stepsOrSubproof.unifyWithSatisfiesAssertion(satisfiesAssertion, context);
|
|
93
93
|
|
|
94
94
|
if (stepOrSubProofUnifiesWIthSatisfiesAssertion) {
|
|
@@ -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,27 +135,27 @@ 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
|
-
const
|
|
152
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
153
153
|
|
|
154
154
|
substitutions = Substitutions.fromNothing();
|
|
155
155
|
|
|
156
|
-
const
|
|
156
|
+
const statementAndSubproofOrProofAssertionsUnify = topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, substitutions, context);
|
|
157
157
|
|
|
158
|
-
if (
|
|
158
|
+
if (statementAndSubproofOrProofAssertionsUnify) {
|
|
159
159
|
const { StatementSubstitution } = elements,
|
|
160
160
|
metavariable = reference.getMetavariable(),
|
|
161
161
|
statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
|
|
@@ -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) {
|
|
@@ -292,8 +292,8 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
|
|
|
292
292
|
|
|
293
293
|
context.trace(`Unifying the '${statementString}' statememnt with the '${satisfiesAssertionString}' satisfies assertion...`);
|
|
294
294
|
|
|
295
|
-
const
|
|
296
|
-
statementUnifies = satisfiesAssertion.
|
|
295
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
296
|
+
statementUnifies = satisfiesAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
|
|
297
297
|
|
|
298
298
|
if (statementUnifies) {
|
|
299
299
|
statementUnifiesWithSatisfiesAssertion = true;
|
|
@@ -307,23 +307,23 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
|
|
|
307
307
|
return statementUnifiesWithSatisfiesAssertion;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
function
|
|
310
|
+
function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion, substitutions, context) {
|
|
311
311
|
let statementEquatesWithStepOrSubproofs = false;
|
|
312
312
|
|
|
313
313
|
if (reference === null) {
|
|
314
314
|
const statementString = statement.getString();
|
|
315
315
|
|
|
316
|
-
context.trace(`Comparing the '${statementString}' statement with the
|
|
316
|
+
context.trace(`Comparing the '${statementString}' statement with the subproofs or proof asssertions...`);
|
|
317
317
|
|
|
318
|
-
const
|
|
319
|
-
statementUnifiesWithSteps = statement.
|
|
318
|
+
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
319
|
+
statementUnifiesWithSteps = statement.compareSubproofOrProofAssertions(subproofOrProofAssertions, context);
|
|
320
320
|
|
|
321
321
|
if (statementUnifiesWithSteps) {
|
|
322
322
|
statementEquatesWithStepOrSubproofs = true;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
if (statementEquatesWithStepOrSubproofs) {
|
|
326
|
-
context.debug(`...compared the '${statementString}' statement with the
|
|
326
|
+
context.debug(`...compared the '${statementString}' statement with the subproofs or proof asssertions.`);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
|
|
@@ -334,11 +334,11 @@ export const unifyStatements = [
|
|
|
334
334
|
unifyStatementWithRule,
|
|
335
335
|
unifyStatementWithReference,
|
|
336
336
|
unifyStatementAsSatisfiesAssertion,
|
|
337
|
-
|
|
337
|
+
unifyStatementWithTopLevelAssertion,
|
|
338
338
|
unifyStatementAEquality,
|
|
339
339
|
unifyStatementAsJudgement,
|
|
340
340
|
unifyStatementAsTypeAssertion,
|
|
341
341
|
unifyStatementAsPropertyAssertion,
|
|
342
342
|
unifyStatementWithSatisfiesAssertion,
|
|
343
|
-
|
|
343
|
+
compareStatementWithSubproofOrProofAssertions
|
|
344
344
|
];
|
|
@@ -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;
|