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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import nominalContext from "../context/nominal";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { literally } from "../utilities/context";
|
|
6
6
|
import { BASE_TYPE_SYMBOL } from "../constants";
|
|
7
7
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
8
8
|
import { instantiateCombinator, instantiateConstructor } from "../process/instantiate";
|
|
@@ -13,18 +13,17 @@ let bracketedCombinator = null,
|
|
|
13
13
|
|
|
14
14
|
export function bracketedCombinatorFromNothing() {
|
|
15
15
|
if (bracketedCombinator === null) {
|
|
16
|
-
|
|
16
|
+
const context = nominalContext; ///
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
bracketedCombinator = literally((context) => {
|
|
19
|
+
const bracketedCombinatorString = `(${STATEMENT_META_TYPE_NAME})`,
|
|
20
|
+
string = bracketedCombinatorString, ///
|
|
21
|
+
combinatorNode = instantiateCombinator(string, context),
|
|
22
|
+
bracketedCombinatorNode = combinatorNode, ///
|
|
23
|
+
bracketedCombinator = combinatorFromCombinatorNode(bracketedCombinatorNode, context);
|
|
19
24
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const combinatorNode = instantiateCombinator(string, context),
|
|
23
|
-
bracketedCombinatorNode = combinatorNode; ///
|
|
24
|
-
|
|
25
|
-
context = contextFromString(string);
|
|
26
|
-
|
|
27
|
-
bracketedCombinator = combinatorFromCombinatorNode(bracketedCombinatorNode, context);
|
|
25
|
+
return bracketedCombinator;
|
|
26
|
+
}, context);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
return bracketedCombinator;
|
|
@@ -32,40 +31,18 @@ export function bracketedCombinatorFromNothing() {
|
|
|
32
31
|
|
|
33
32
|
export function bracketedConstructorFromNothing() {
|
|
34
33
|
if (bracketedConstructor === null) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const string = `(${BASE_TYPE_SYMBOL})`;
|
|
38
|
-
|
|
39
|
-
context = nominalContext; ///
|
|
40
|
-
|
|
41
|
-
const constructorNode = instantiateConstructor(string, context),
|
|
42
|
-
bracketedConstructorNode = constructorNode; ///
|
|
34
|
+
const context = nominalContext; ///
|
|
43
35
|
|
|
44
|
-
|
|
36
|
+
bracketedConstructor = literally((context) => {
|
|
37
|
+
const bracketedConstructorString = `(${BASE_TYPE_SYMBOL})`,
|
|
38
|
+
string = bracketedConstructorString, ///
|
|
39
|
+
constructorNode = instantiateConstructor(string, context),
|
|
40
|
+
bracketedConstructorNode = constructorNode, ///
|
|
41
|
+
bracketedConstructor = constructorFromConstructorNode(bracketedConstructorNode, context);
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
return bracketedConstructor;
|
|
44
|
+
}, context);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
return bracketedConstructor;
|
|
50
48
|
}
|
|
51
|
-
|
|
52
|
-
function contextFromString(string) {
|
|
53
|
-
const context = {
|
|
54
|
-
nodeAsString: () => string,
|
|
55
|
-
getMetaTypes: () => getMetaTypes(),
|
|
56
|
-
findMetaTypeByMetaTypeName(metaTypeName) {
|
|
57
|
-
const metaTypes = this.getMetaTypes(),
|
|
58
|
-
metaType = metaTypes.find((metaType) => {
|
|
59
|
-
const metaTypeComparesToMetaTypeName = metaType.compareMetaTypeName(metaTypeName);
|
|
60
|
-
|
|
61
|
-
if (metaTypeComparesToMetaTypeName) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
}) || null;
|
|
65
|
-
|
|
66
|
-
return metaType;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
return context;
|
|
71
|
-
}
|
package/src/utilities/json.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import elements from "../elements";
|
|
4
4
|
|
|
5
|
+
import { findMetaTypeByMetaTypeName } from "../metaTypes";
|
|
6
|
+
|
|
5
7
|
export function termFromJSON(json, context) {
|
|
6
8
|
let { term } = json;
|
|
7
9
|
|
|
@@ -42,7 +44,7 @@ export function metaTypeFromJSON(json, context) {
|
|
|
42
44
|
const { name } = json,
|
|
43
45
|
metaTypeName = name; ///
|
|
44
46
|
|
|
45
|
-
metaType =
|
|
47
|
+
metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
return metaType;
|
package/src/utilities/string.js
CHANGED
|
@@ -44,7 +44,7 @@ export function premisesStringFromPremises(premises) {
|
|
|
44
44
|
return premisesString;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export function hypothesesStringFromHypotheses(hypotheses
|
|
47
|
+
export function hypothesesStringFromHypotheses(hypotheses) {
|
|
48
48
|
const hypothesesString = hypotheses.reduce((hypothesesString, hypothesis) => {
|
|
49
49
|
const hypothesisString = hypothesis.getString();
|
|
50
50
|
|
|
@@ -94,8 +94,8 @@ export function assumptionsStringFromAssumptions(assumptions) {
|
|
|
94
94
|
const assumptionString = assumption.getString();
|
|
95
95
|
|
|
96
96
|
assumptionsString = (assumptionsString === null) ?
|
|
97
|
-
assumptionString
|
|
98
|
-
|
|
97
|
+
assumptionString: ///
|
|
98
|
+
`${assumptionsString}, ${assumptionString}`;
|
|
99
99
|
|
|
100
100
|
return assumptionsString;
|
|
101
101
|
}, null);
|
|
@@ -145,6 +145,14 @@ export function equivalenceStringFromTerms(terms) {
|
|
|
145
145
|
return equivalenceString;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
export function termSubstitutionStringFromTermAndVariable(term, variable) {
|
|
149
|
+
const termString = term.getString(),
|
|
150
|
+
variableString = variable.getString(),
|
|
151
|
+
termSubstitutionString = `[${termString} for ${variableString}]`;
|
|
152
|
+
|
|
153
|
+
return termSubstitutionString;
|
|
154
|
+
}
|
|
155
|
+
|
|
148
156
|
export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conclusion) {
|
|
149
157
|
const premisesString = premisesStringFromPremises(premises),
|
|
150
158
|
conclusionString = conclusion.getString(),
|
|
@@ -156,6 +164,17 @@ export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conc
|
|
|
156
164
|
return ruleString;
|
|
157
165
|
}
|
|
158
166
|
|
|
167
|
+
export function sectionStringFromHypothesesTopLevelAssertion(hypotheses, axiom, lemma, theorem, conjecture) {
|
|
168
|
+
const topLevelAssertion = (axiom || lemma || theorem || conjecture),
|
|
169
|
+
topLevelAssertionString = topLevelAssertion.getString(),
|
|
170
|
+
hypothesesString = hypothesesStringFromHypotheses(hypotheses),
|
|
171
|
+
sectionString = (topLevelAssertionString !== null) ?
|
|
172
|
+
`[${hypothesesString}]::: ${topLevelAssertionString}` :
|
|
173
|
+
`[${hypothesesString}]::: `;
|
|
174
|
+
|
|
175
|
+
return sectionString;
|
|
176
|
+
}
|
|
177
|
+
|
|
159
178
|
export function subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation) {
|
|
160
179
|
const lastProofAssertion = subDerivation.getLastProofAssertion(),
|
|
161
180
|
suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
@@ -165,6 +184,14 @@ export function subproofStringFromSuppositionsAndSubDerivation(suppositions, sub
|
|
|
165
184
|
return subproofString;
|
|
166
185
|
}
|
|
167
186
|
|
|
187
|
+
export function frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable) {
|
|
188
|
+
const frameString = frame.getString(),
|
|
189
|
+
metavariableString = metavariable.getString(),
|
|
190
|
+
string = `[${frameString} for [${metavariableString}]]`;
|
|
191
|
+
|
|
192
|
+
return string;
|
|
193
|
+
}
|
|
194
|
+
|
|
168
195
|
export function typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes) {
|
|
169
196
|
let typeString;
|
|
170
197
|
|
|
@@ -189,44 +216,58 @@ export function procedureCallStringFromProcedureReferenceAndParameters(procedure
|
|
|
189
216
|
return procedureCallString;
|
|
190
217
|
}
|
|
191
218
|
|
|
192
|
-
export function
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
sectionString = (axiomLemmaTheoremOrConjectureString !== null) ?
|
|
197
|
-
`[${hypothesesString}]::: ${axiomLemmaTheoremOrConjectureString}` :
|
|
198
|
-
`[${hypothesesString}]::: `;
|
|
219
|
+
export function statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable) {
|
|
220
|
+
const statementString = statement.getString(),
|
|
221
|
+
metavariableString = metavariable.getString(),
|
|
222
|
+
statementSubstitutionString = `[${statementString} for ${metavariableString}]`;
|
|
199
223
|
|
|
200
|
-
return
|
|
224
|
+
return statementSubstitutionString;
|
|
201
225
|
}
|
|
202
226
|
|
|
203
|
-
export function
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
metaLemmaMetatheoremString = (suppositionsString !== null) ?
|
|
208
|
-
`${labelString} :: [${suppositionsString}]...${deductionString}` :
|
|
209
|
-
`${labelString} :: ${deductionString}`;
|
|
227
|
+
export function referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable) {
|
|
228
|
+
const referenceString = reference.getString(),
|
|
229
|
+
metavariableString = metavariable.getString(),
|
|
230
|
+
referenceSubstitutionString = `[${referenceString} for ${metavariableString}]`;
|
|
210
231
|
|
|
211
|
-
return
|
|
232
|
+
return referenceSubstitutionString;
|
|
212
233
|
}
|
|
213
234
|
|
|
214
|
-
export function
|
|
215
|
-
let
|
|
235
|
+
export function topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction) {
|
|
236
|
+
let topLevelAssertionString;
|
|
216
237
|
|
|
217
238
|
const suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
218
239
|
deductionString = deduction.getString(),
|
|
219
240
|
labelsString = labelsStringFromLabels(labels);
|
|
220
241
|
|
|
221
242
|
if (labelsString !== null) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
243
|
+
topLevelAssertionString = (suppositionsString !== null) ?
|
|
244
|
+
`${labelsString} :: [${suppositionsString}]...${deductionString}` :
|
|
245
|
+
`${labelsString} :: ${deductionString}`;
|
|
225
246
|
} else {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
247
|
+
topLevelAssertionString = (suppositionsString !== null) ?
|
|
248
|
+
`[${suppositionsString}]...${deductionString}` :
|
|
249
|
+
deductionString;
|
|
229
250
|
}
|
|
230
251
|
|
|
231
|
-
return
|
|
252
|
+
return topLevelAssertionString;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction) {
|
|
256
|
+
const suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
257
|
+
deductionString = deduction.getString(),
|
|
258
|
+
labelString = label.getString(),
|
|
259
|
+
topLevelMetaAssertionString = (suppositionsString !== null) ?
|
|
260
|
+
`${labelString} :: [${suppositionsString}]...${deductionString}` :
|
|
261
|
+
`${labelString} :: ${deductionString}`;
|
|
262
|
+
|
|
263
|
+
return topLevelMetaAssertionString;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution) {
|
|
267
|
+
const statementString = statement.getString(),
|
|
268
|
+
metavariableString = metavariable.getString(),
|
|
269
|
+
substitutionString = substitution.getString(),
|
|
270
|
+
statementSubstitutionString = `[${statementString} for ${metavariableString}${substitutionString}]`;
|
|
271
|
+
|
|
272
|
+
return statementSubstitutionString;
|
|
232
273
|
}
|
|
@@ -4,6 +4,7 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import elements from "../elements";
|
|
6
6
|
|
|
7
|
+
import { synthetically } from "../utilities/context";
|
|
7
8
|
import { equalityFromStatement,
|
|
8
9
|
judgementFromStatement,
|
|
9
10
|
typeAssertionFromStatement,
|
|
@@ -12,7 +13,7 @@ import { equalityFromStatement,
|
|
|
12
13
|
|
|
13
14
|
const { backwardsSome } = arrayUtilities;
|
|
14
15
|
|
|
15
|
-
function unifyStatementWithRule(statement, reference, satisfiesAssertion,
|
|
16
|
+
function unifyStatementWithRule(statement, reference, satisfiesAssertion, context) {
|
|
16
17
|
let statementUnifiesWithRule = false;
|
|
17
18
|
|
|
18
19
|
if (reference !== null) {
|
|
@@ -40,7 +41,7 @@ function unifyStatementWithRule(statement, reference, satisfiesAssertion, substi
|
|
|
40
41
|
return statementUnifiesWithRule;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
function unifyStatementWithReference(statement, reference, satisfiesAssertion,
|
|
44
|
+
function unifyStatementWithReference(statement, reference, satisfiesAssertion, context) {
|
|
44
45
|
let statementUnifiesWithReference = false;
|
|
45
46
|
|
|
46
47
|
if (reference !== null) {
|
|
@@ -52,12 +53,14 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
|
|
|
52
53
|
const metavariableValidates = reference.validateMetavariable(context);
|
|
53
54
|
|
|
54
55
|
if (metavariableValidates) {
|
|
55
|
-
const
|
|
56
|
-
metavariable = reference.getMetavariable(),
|
|
57
|
-
statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
|
|
58
|
-
substitution = statementSubstitution; ///
|
|
56
|
+
const metavariable = reference.getMetavariable();
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
synthetically((context) => {
|
|
59
|
+
const { StatementSubstitution } = elements;
|
|
60
|
+
|
|
61
|
+
StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
62
|
+
|
|
63
|
+
}, generalContext, specificContext);
|
|
61
64
|
|
|
62
65
|
statementUnifiesWithReference = true;
|
|
63
66
|
}
|
|
@@ -70,7 +73,7 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
|
|
|
70
73
|
return statementUnifiesWithReference;
|
|
71
74
|
}
|
|
72
75
|
|
|
73
|
-
function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAssertion,
|
|
76
|
+
function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
|
|
74
77
|
let statementUnifiesAsSatisfiesAssertion = false;
|
|
75
78
|
|
|
76
79
|
satisfiesAssertion = satisfiesAssertionFromStatement(statement, context);
|
|
@@ -96,9 +99,9 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
|
|
|
96
99
|
}
|
|
97
100
|
});
|
|
98
101
|
} else {
|
|
99
|
-
const
|
|
102
|
+
const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
100
103
|
|
|
101
|
-
if (
|
|
104
|
+
if (topLevelAssertion !== null) {
|
|
102
105
|
reference = satisfiesAssertion.getReference();
|
|
103
106
|
|
|
104
107
|
const axiom = context.findAxiomByReference(reference);
|
|
@@ -108,10 +111,10 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
|
|
|
108
111
|
|
|
109
112
|
if (satisfiable) {
|
|
110
113
|
const { Substitutions } = elements,
|
|
111
|
-
substitutions = Substitutions.fromNothing(),
|
|
112
|
-
|
|
114
|
+
substitutions = Substitutions.fromNothing(context),
|
|
115
|
+
topLevelAssertionUnifies = axiom.unifyTopLevelAssertion(topLevelAssertion, substitutions, context);
|
|
113
116
|
|
|
114
|
-
if (
|
|
117
|
+
if (topLevelAssertionUnifies) {
|
|
115
118
|
const substitutionsCorrelates = satisfiesAssertion.correlateSubstitutions(substitutions, context);
|
|
116
119
|
|
|
117
120
|
if (substitutionsCorrelates) {
|
|
@@ -135,49 +138,49 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
|
|
|
135
138
|
return statementUnifiesAsSatisfiesAssertion;
|
|
136
139
|
}
|
|
137
140
|
|
|
138
|
-
function
|
|
139
|
-
let
|
|
141
|
+
function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAssertion, context) {
|
|
142
|
+
let statementUnifiesWithTopLevelAssertion = false;
|
|
140
143
|
|
|
141
144
|
if (reference !== null) {
|
|
142
145
|
const { Substitutions } = elements,
|
|
143
|
-
|
|
146
|
+
topLevelAssertion = context.findTopLevelAssertionByReference(reference),
|
|
144
147
|
generalSubstitutions = substitutions; ///
|
|
145
148
|
|
|
146
|
-
if (
|
|
149
|
+
if (topLevelAssertion !== null) {
|
|
147
150
|
const statementString = statement.getString(),
|
|
148
|
-
|
|
151
|
+
topLevelAssertionString = reference.getString();
|
|
149
152
|
|
|
150
|
-
context.trace(`Unifying the '${statementString}' statement with the '${
|
|
153
|
+
context.trace(`Unifying the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion...`);
|
|
151
154
|
|
|
152
155
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
153
156
|
|
|
154
|
-
substitutions = Substitutions.fromNothing();
|
|
157
|
+
substitutions = Substitutions.fromNothing(context);
|
|
155
158
|
|
|
156
|
-
const statementAndSubproofOrProofAssertionsUnify =
|
|
159
|
+
const statementAndSubproofOrProofAssertionsUnify = topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, substitutions, context);
|
|
157
160
|
|
|
158
161
|
if (statementAndSubproofOrProofAssertionsUnify) {
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
const metavariable = reference.getMetavariable();
|
|
163
|
+
|
|
164
|
+
synthetically((context) => {
|
|
165
|
+
const { StatementSubstitution } = elements;
|
|
163
166
|
|
|
164
|
-
|
|
167
|
+
StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
165
168
|
|
|
166
|
-
|
|
169
|
+
}, generalContext, specificContext);
|
|
167
170
|
|
|
168
|
-
|
|
171
|
+
statementUnifiesWithTopLevelAssertion = true;
|
|
169
172
|
}
|
|
170
173
|
|
|
171
|
-
if (
|
|
172
|
-
context.debug(`...unified the '${statementString}' statement with the '${
|
|
174
|
+
if (statementUnifiesWithTopLevelAssertion) {
|
|
175
|
+
context.debug(`...unified the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion.`);
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
178
|
}
|
|
176
179
|
|
|
177
|
-
return
|
|
180
|
+
return statementUnifiesWithTopLevelAssertion;
|
|
178
181
|
}
|
|
179
182
|
|
|
180
|
-
function unifyStatementAEquality(statement, reference, satisfiesAssertion,
|
|
183
|
+
function unifyStatementAEquality(statement, reference, satisfiesAssertion, context) {
|
|
181
184
|
let statementUnifiesAEquality = false;
|
|
182
185
|
|
|
183
186
|
if (reference === null) {
|
|
@@ -203,7 +206,7 @@ function unifyStatementAEquality(statement, reference, satisfiesAssertion, subst
|
|
|
203
206
|
return statementUnifiesAEquality;
|
|
204
207
|
}
|
|
205
208
|
|
|
206
|
-
function unifyStatementAsJudgement(statement, reference, satisfiesAssertion,
|
|
209
|
+
function unifyStatementAsJudgement(statement, reference, satisfiesAssertion, context) {
|
|
207
210
|
let statementUnifiesAsJudgement = false;
|
|
208
211
|
|
|
209
212
|
if (reference === null) {
|
|
@@ -225,7 +228,7 @@ function unifyStatementAsJudgement(statement, reference, satisfiesAssertion, sub
|
|
|
225
228
|
return statementUnifiesAsJudgement;
|
|
226
229
|
}
|
|
227
230
|
|
|
228
|
-
function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion,
|
|
231
|
+
function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion, context) {
|
|
229
232
|
let statementUnifiesAsTypeAssertion = false;
|
|
230
233
|
|
|
231
234
|
if (reference === null) {
|
|
@@ -245,7 +248,7 @@ function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion,
|
|
|
245
248
|
return statementUnifiesAsTypeAssertion;
|
|
246
249
|
}
|
|
247
250
|
|
|
248
|
-
function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssertion,
|
|
251
|
+
function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssertion, context) {
|
|
249
252
|
let statementUnifiesAsPropertyAssertion = false;
|
|
250
253
|
|
|
251
254
|
if (reference === null) {
|
|
@@ -283,7 +286,7 @@ function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssert
|
|
|
283
286
|
return statementUnifiesAsPropertyAssertion;
|
|
284
287
|
}
|
|
285
288
|
|
|
286
|
-
function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAssertion,
|
|
289
|
+
function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
|
|
287
290
|
let statementUnifiesWithSatisfiesAssertion = false;
|
|
288
291
|
|
|
289
292
|
if (satisfiesAssertion !== null) {
|
|
@@ -307,7 +310,7 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
|
|
|
307
310
|
return statementUnifiesWithSatisfiesAssertion;
|
|
308
311
|
}
|
|
309
312
|
|
|
310
|
-
function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion,
|
|
313
|
+
function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion, context) {
|
|
311
314
|
let statementEquatesWithStepOrSubproofs = false;
|
|
312
315
|
|
|
313
316
|
if (reference === null) {
|
|
@@ -334,7 +337,7 @@ export const unifyStatements = [
|
|
|
334
337
|
unifyStatementWithRule,
|
|
335
338
|
unifyStatementWithReference,
|
|
336
339
|
unifyStatementAsSatisfiesAssertion,
|
|
337
|
-
|
|
340
|
+
unifyStatementWithTopLevelAssertion,
|
|
338
341
|
unifyStatementAEquality,
|
|
339
342
|
unifyStatementAsJudgement,
|
|
340
343
|
unifyStatementAsTypeAssertion,
|