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
package/src/element/statement.js
CHANGED
|
@@ -7,7 +7,6 @@ import Element from "../element";
|
|
|
7
7
|
import { define } from "../elements";
|
|
8
8
|
import { unifyStatement } from "../process/unify";
|
|
9
9
|
import { validateStatements } from "../utilities/validation";
|
|
10
|
-
import { instantiateStatement } from "../process/instantiate";
|
|
11
10
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
12
11
|
|
|
13
12
|
const { match, backwardsSome } = arrayUtilities;
|
|
@@ -17,20 +16,6 @@ export default define(class Statement extends Element {
|
|
|
17
16
|
super(context, string, node);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
getMetavariableName() {
|
|
21
|
-
let metavariableName = null;
|
|
22
|
-
|
|
23
|
-
const singular = this.isSingular();
|
|
24
|
-
|
|
25
|
-
if (singular) {
|
|
26
|
-
const node = this.getNode();
|
|
27
|
-
|
|
28
|
-
metavariableName = node.getMetavariableName();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return metavariableName;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
19
|
isSingular() {
|
|
35
20
|
const node = this.getNode(),
|
|
36
21
|
singular = node.isSingular();
|
|
@@ -38,6 +23,13 @@ export default define(class Statement extends Element {
|
|
|
38
23
|
return singular;
|
|
39
24
|
}
|
|
40
25
|
|
|
26
|
+
getMetavariableName() {
|
|
27
|
+
const node = this.getNode(),
|
|
28
|
+
metavariableName = node.getMetavariableName();
|
|
29
|
+
|
|
30
|
+
return metavariableName;
|
|
31
|
+
}
|
|
32
|
+
|
|
41
33
|
isTermContained(term, context) {
|
|
42
34
|
let termContained;
|
|
43
35
|
|
|
@@ -45,7 +37,7 @@ export default define(class Statement extends Element {
|
|
|
45
37
|
termString = term.getString(),
|
|
46
38
|
statementString = this.getString(); ///
|
|
47
39
|
|
|
48
|
-
context.trace(`Is the '${termString}' term contained in the '${statementString}' statement
|
|
40
|
+
context.trace(`Is the '${termString}' term contained in the '${statementString}' statement...`);
|
|
49
41
|
|
|
50
42
|
const statementNode = node, ///
|
|
51
43
|
statementNodeTermNodes = statementNode.getTermNodes();
|
|
@@ -59,7 +51,7 @@ export default define(class Statement extends Element {
|
|
|
59
51
|
});
|
|
60
52
|
|
|
61
53
|
if (termContained) {
|
|
62
|
-
context.debug(`...the '${termString}' term is contained in the '${statementString}' statement
|
|
54
|
+
context.debug(`...the '${termString}' term is contained in the '${statementString}' statement.`);
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
return termContained;
|
|
@@ -68,13 +60,13 @@ export default define(class Statement extends Element {
|
|
|
68
60
|
isFrameContained(frame, context) {
|
|
69
61
|
let frameContained;
|
|
70
62
|
|
|
71
|
-
const
|
|
72
|
-
frameString = frame.getString(),
|
|
63
|
+
const frameString = frame.getString(),
|
|
73
64
|
statementString = this.getString(); ///
|
|
74
65
|
|
|
75
|
-
context.trace(`Is the '${frameString}' frame contained in the '${statementString}' statement
|
|
66
|
+
context.trace(`Is the '${frameString}' frame contained in the '${statementString}' statement...`);
|
|
76
67
|
|
|
77
|
-
const
|
|
68
|
+
const node = this.getNode(),
|
|
69
|
+
statementNode = node, ///
|
|
78
70
|
statementNodeFrameNodes = statementNode.getFrameNodes();
|
|
79
71
|
|
|
80
72
|
frameContained = statementNodeFrameNodes.some((statementNodeFrameNode) => { ///
|
|
@@ -86,7 +78,7 @@ export default define(class Statement extends Element {
|
|
|
86
78
|
});
|
|
87
79
|
|
|
88
80
|
if (frameContained) {
|
|
89
|
-
context.debug(`...the '${frameString}' frame is contained in the '${statementString}' statement
|
|
81
|
+
context.debug(`...the '${frameString}' frame is contained in the '${statementString}' statement.`);
|
|
90
82
|
}
|
|
91
83
|
|
|
92
84
|
return frameContained;
|
|
@@ -114,13 +106,32 @@ export default define(class Statement extends Element {
|
|
|
114
106
|
return metavariableEqualToMetavariable;
|
|
115
107
|
}
|
|
116
108
|
|
|
109
|
+
compareParameter(parameter) {
|
|
110
|
+
let comparesToParamter = false;
|
|
111
|
+
|
|
112
|
+
const singular = this.isSingular();
|
|
113
|
+
|
|
114
|
+
if (singular) {
|
|
115
|
+
const parameterName = parameter.getName();
|
|
116
|
+
|
|
117
|
+
if (parameterName !== null) {
|
|
118
|
+
const metavariableName = this.getMetavariableName();
|
|
119
|
+
|
|
120
|
+
if (parameterName === metavariableName) {
|
|
121
|
+
comparesToParamter = true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return comparesToParamter;
|
|
127
|
+
}
|
|
128
|
+
|
|
117
129
|
validate(assignments, stated, context) {
|
|
118
130
|
let validates;
|
|
119
131
|
|
|
120
|
-
const
|
|
121
|
-
statementString = this.getString(); ///
|
|
132
|
+
const statementString = this.getString(); ///
|
|
122
133
|
|
|
123
|
-
context.trace(`Validating the '${statementString}' statement
|
|
134
|
+
context.trace(`Validating the '${statementString}' statement...`);
|
|
124
135
|
|
|
125
136
|
validates = validateStatements.some((validateStatement) => {
|
|
126
137
|
const statement = this, ///
|
|
@@ -136,7 +147,7 @@ export default define(class Statement extends Element {
|
|
|
136
147
|
|
|
137
148
|
context.addStatement(statement);
|
|
138
149
|
|
|
139
|
-
context.debug(`...validated the '${statementString}' statement
|
|
150
|
+
context.debug(`...validated the '${statementString}' statement.`);
|
|
140
151
|
}
|
|
141
152
|
|
|
142
153
|
return validates;
|
|
@@ -145,11 +156,10 @@ export default define(class Statement extends Element {
|
|
|
145
156
|
validateGivenMetaType(metaType, assignments, stated, context) {
|
|
146
157
|
let validatesGivenMetaType = false;
|
|
147
158
|
|
|
148
|
-
const
|
|
149
|
-
metaTypeString = metaType.getString(),
|
|
159
|
+
const metaTypeString = metaType.getString(),
|
|
150
160
|
statementString = this.getString(); ///
|
|
151
161
|
|
|
152
|
-
context.trace(`Validating the '${statementString}' statement given the '${metaTypeString}' meta-type
|
|
162
|
+
context.trace(`Validating the '${statementString}' statement given the '${metaTypeString}' meta-type...`);
|
|
153
163
|
|
|
154
164
|
const metaTypeName = metaType.getName();
|
|
155
165
|
|
|
@@ -160,7 +170,7 @@ export default define(class Statement extends Element {
|
|
|
160
170
|
}
|
|
161
171
|
|
|
162
172
|
if (validatesGivenMetaType) {
|
|
163
|
-
context.debug(`...validated the '${statementString}' statement given the '${metaTypeString}' meta-type
|
|
173
|
+
context.debug(`...validated the '${statementString}' statement given the '${metaTypeString}' meta-type.`);
|
|
164
174
|
}
|
|
165
175
|
|
|
166
176
|
return validatesGivenMetaType;
|
|
@@ -170,13 +180,13 @@ export default define(class Statement extends Element {
|
|
|
170
180
|
let subproofUnifies = false;
|
|
171
181
|
|
|
172
182
|
const node = this.getNode(),
|
|
173
|
-
|
|
174
|
-
statementNode = node,
|
|
183
|
+
statementNode = node, ///
|
|
175
184
|
subproofAssertionNode = statementNode.getSubproofAssertionNode(),
|
|
176
185
|
assertionNode = subproofAssertionNode; ///
|
|
177
186
|
|
|
178
187
|
if (assertionNode !== null) {
|
|
179
|
-
const
|
|
188
|
+
const context = generalContext, ///
|
|
189
|
+
assertion = context.findAssertionByAssertionNode(assertionNode),
|
|
180
190
|
subproofAssertion = assertion; ///
|
|
181
191
|
|
|
182
192
|
const subproofString = subproof.getString(),
|
|
@@ -208,17 +218,18 @@ export default define(class Statement extends Element {
|
|
|
208
218
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
209
219
|
let statementUnifies;
|
|
210
220
|
|
|
211
|
-
const
|
|
221
|
+
const context = specificContext, ///
|
|
222
|
+
generalStatement = this, ///
|
|
212
223
|
specificStatement = statement, ///
|
|
213
224
|
generalStatementString = generalStatement.getString(),
|
|
214
225
|
specificStatementString = specificStatement.getString();
|
|
215
226
|
|
|
216
|
-
|
|
227
|
+
context.trace(`Unifying the '${specificStatementString}' statement with the '${generalStatementString}' statement...`);
|
|
217
228
|
|
|
218
229
|
statementUnifies = unifyStatement(generalStatement, specificStatement, substitutions, generalContext, specificContext);
|
|
219
230
|
|
|
220
231
|
if (statementUnifies) {
|
|
221
|
-
|
|
232
|
+
context.debug(`...unified the '${specificStatementString}' statement with the '${generalStatementString}' statement.`);
|
|
222
233
|
}
|
|
223
234
|
|
|
224
235
|
return statementUnifies;
|
|
@@ -238,8 +249,9 @@ export default define(class Statement extends Element {
|
|
|
238
249
|
containedAssertionNode = statementNode.getContainedAssertionNode();
|
|
239
250
|
|
|
240
251
|
if ((definedAssertionNode !== null) || (containedAssertionNode !== null)) {
|
|
241
|
-
const
|
|
242
|
-
|
|
252
|
+
const context = generalContext, ///
|
|
253
|
+
assertionNode = (definedAssertionNode || containedAssertionNode),
|
|
254
|
+
assertion = context.findAssertionByAssertionNode(assertionNode),
|
|
243
255
|
assertionUnifiesIndependently = assertion.unifyIndependently(substitutions, generalContext, specificContext);
|
|
244
256
|
|
|
245
257
|
if (assertionUnifiesIndependently) {
|
|
@@ -270,7 +282,7 @@ export default define(class Statement extends Element {
|
|
|
270
282
|
}
|
|
271
283
|
|
|
272
284
|
toJSON() {
|
|
273
|
-
const string = this.getString(),
|
|
285
|
+
const string = this.getString(), ///
|
|
274
286
|
json = {
|
|
275
287
|
string
|
|
276
288
|
};
|
|
@@ -281,14 +293,6 @@ export default define(class Statement extends Element {
|
|
|
281
293
|
static name = "Statement";
|
|
282
294
|
|
|
283
295
|
static fromJSON(json, context) {
|
|
284
|
-
|
|
285
|
-
statmentNode = instantiateStatement(string, context),
|
|
286
|
-
node = statmentNode; ///,
|
|
287
|
-
|
|
288
|
-
context = null;
|
|
289
|
-
|
|
290
|
-
const statement = new Statement(context, string, node);
|
|
291
|
-
|
|
292
|
-
return statement;
|
|
296
|
+
///
|
|
293
297
|
}
|
|
294
298
|
});
|
package/src/element/subproof.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
4
|
import elements from "../elements";
|
|
5
|
-
import LocalContext from "../context/local";
|
|
6
5
|
|
|
6
|
+
import { scope } from "../utilities/context";
|
|
7
7
|
import { define } from "../elements";
|
|
8
8
|
|
|
9
9
|
export default define(class Subproof extends Element {
|
|
@@ -49,25 +49,23 @@ export default define(class Subproof extends Element {
|
|
|
49
49
|
verify(substitutions, assignments, context) {
|
|
50
50
|
let verifies = false;
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
scope(() => {
|
|
53
|
+
const suppositionsVerify = this.suppositions.every((supposition) => {
|
|
54
|
+
const suppositionVerifies = supposition.verify(context);
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (suppositionVerifies) {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
56
|
+
if (suppositionVerifies) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
if (suppositionsVerify) {
|
|
62
|
+
const subDerivationVerifies = this.subDerivation.verify(substitutions, context);
|
|
66
63
|
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
if (subDerivationVerifies) {
|
|
65
|
+
verifies = true;
|
|
66
|
+
}
|
|
69
67
|
}
|
|
70
|
-
}
|
|
68
|
+
}, context);
|
|
71
69
|
|
|
72
70
|
return verifies;
|
|
73
71
|
}
|
|
@@ -81,7 +79,7 @@ export default define(class Subproof extends Element {
|
|
|
81
79
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
82
80
|
let unifiesWithSatisfiesAssertion = false;
|
|
83
81
|
|
|
84
|
-
const subproofString = this.
|
|
82
|
+
const subproofString = this.getString(), ///
|
|
85
83
|
satisfiesAssertionString = satisfiesAssertion.getString();
|
|
86
84
|
|
|
87
85
|
context.trace(`Unifying the '${subproofString}' subproof with the '${satisfiesAssertionString}' satisfies assertion...`)
|
|
@@ -95,7 +93,7 @@ export default define(class Subproof extends Element {
|
|
|
95
93
|
if (axiomSatisfiable) {
|
|
96
94
|
const { Substitutions } = elements,
|
|
97
95
|
subproof = this, ///
|
|
98
|
-
substitutions = Substitutions.fromNothing(),
|
|
96
|
+
substitutions = Substitutions.fromNothing(context),
|
|
99
97
|
statementUnifies = axiom.unifySubproof(subproof, substitutions, context);
|
|
100
98
|
|
|
101
99
|
if (statementUnifies) {
|
|
@@ -3,77 +3,134 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
+
import { literally } from "../../utilities/context";
|
|
6
7
|
import { instantiateFrameSubstitution } from "../../process/instantiate";
|
|
7
|
-
import {
|
|
8
|
+
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
9
|
+
import { frameSubstitutionFromStatementNode, frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
|
|
8
10
|
|
|
9
11
|
export default define(class FrameSubstitution extends Substitution {
|
|
10
|
-
constructor(context, string, node,
|
|
12
|
+
constructor(context, string, node, targetFrame, replacementFrame) {
|
|
11
13
|
super(context, string, node);
|
|
12
14
|
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
+
this.targetFrame = targetFrame;
|
|
16
|
+
this.replacementFrame = replacementFrame;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
return this.
|
|
19
|
+
getTargetFrame() {
|
|
20
|
+
return this.targetFrame;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
return this.
|
|
23
|
+
getReplacementFrame() {
|
|
24
|
+
return this.replacementFrame;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getTargetNode() {
|
|
28
|
+
const targetFrameNode = this.targetFrame.getNode(),
|
|
29
|
+
tergetNode = targetFrameNode; ///
|
|
30
|
+
|
|
31
|
+
return tergetNode;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
getReplacementNode() {
|
|
26
|
-
const
|
|
27
|
-
replacementNode =
|
|
35
|
+
const replacementFrameNode = this.replacementFrame.getNode(),
|
|
36
|
+
replacementNode = replacementFrameNode; ///
|
|
28
37
|
|
|
29
38
|
return replacementNode;
|
|
30
39
|
}
|
|
31
40
|
|
|
32
|
-
|
|
41
|
+
isTrivial() {
|
|
42
|
+
const targetFrameEqualToReplacementFrame = this.targetFrame.isEqualTo(this.replacementFrame),
|
|
43
|
+
trivial = targetFrameEqualToReplacementFrame; ///
|
|
44
|
+
|
|
45
|
+
return trivial;
|
|
46
|
+
}
|
|
33
47
|
|
|
34
|
-
|
|
48
|
+
compareFrame(frame, context) {
|
|
49
|
+
const frameEqualToReplacementFrame = this.replacementFrame.isEqualTo(frame),
|
|
50
|
+
comparedToFrame = frameEqualToReplacementFrame; ///
|
|
35
51
|
|
|
36
|
-
|
|
37
|
-
|
|
52
|
+
return comparedToFrame;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
compareParameter(parameter) {
|
|
56
|
+
const targetFrameComparesToParameter = this.targetFrame.compareParameter(parameter),
|
|
57
|
+
comparesToParameter = targetFrameComparesToParameter; ///
|
|
58
|
+
|
|
59
|
+
return comparesToParameter;
|
|
60
|
+
}
|
|
38
61
|
|
|
39
|
-
|
|
62
|
+
validate(context) {
|
|
63
|
+
let validates = false;
|
|
40
64
|
|
|
41
|
-
|
|
65
|
+
const frameSubstitutionString = this.getString(); ///
|
|
42
66
|
|
|
43
|
-
|
|
67
|
+
context.trace(`Validating the '${frameSubstitutionString}' frame substitution...`);
|
|
44
68
|
|
|
45
|
-
|
|
46
|
-
if (this.metavariable !== null) {
|
|
47
|
-
const metavariablePresent = context.isMetavariablePresent(this.metavariable);
|
|
69
|
+
const targetFrameValidates = this.validateTargetFrame(context);
|
|
48
70
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
frameMetavariablePresent = context.isMetavariablePresent(frameMetavariable);
|
|
71
|
+
if (targetFrameValidates) {
|
|
72
|
+
const replacementFrameValidates = this.validateReplacementFrame(context);
|
|
52
73
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} else {
|
|
56
|
-
context.debug(`The '${frameSubstitutionString}' frame substitution's general frame's metavariable is not present.`);
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
context.debug(`The '${frameSubstitutionString}' frame substitution's specific frame's metavariable is not present.`);
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
context.debug(`The '${frameSubstitutionString}' frame substitution's general frame is not singular.`);
|
|
74
|
+
if (replacementFrameValidates) {
|
|
75
|
+
validates = true;
|
|
63
76
|
}
|
|
64
|
-
} else {
|
|
65
|
-
context.debug(`The '${frameSubstitutionString}' frame substitution's specific frame is not singular.`);
|
|
66
77
|
}
|
|
67
78
|
|
|
68
|
-
if (
|
|
79
|
+
if (validates) {
|
|
69
80
|
const substititoin = this; ///
|
|
70
81
|
|
|
71
82
|
context.addSubstitution(substititoin);
|
|
72
83
|
|
|
73
|
-
context.debug(`...
|
|
84
|
+
context.debug(`...validated the '${frameSubstitutionString}' frame substitution.`);
|
|
74
85
|
}
|
|
75
86
|
|
|
76
|
-
return
|
|
87
|
+
return validates;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
validateTargetFrame(context) {
|
|
91
|
+
let targetFrameValidates = false;
|
|
92
|
+
|
|
93
|
+
const targetFrameString = this.targetFrame.getString(),
|
|
94
|
+
frameSubstitutionString = this.getString(); ///
|
|
95
|
+
|
|
96
|
+
context.trace(`Validating the '${frameSubstitutionString}' frame subtitution's '${targetFrameString}' target frame...`);
|
|
97
|
+
|
|
98
|
+
const targetFrameSingular = this.targetFrame.isSingular();
|
|
99
|
+
|
|
100
|
+
if (targetFrameSingular) {
|
|
101
|
+
const stated = true,
|
|
102
|
+
assignments = null;
|
|
103
|
+
|
|
104
|
+
targetFrameValidates = this.targetFrame.validate(assignments, stated, context);
|
|
105
|
+
} else {
|
|
106
|
+
context.debug(`The '${frameSubstitutionString}' frame subtitution's '${targetFrameString}' target frame is not singular.`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (targetFrameValidates) {
|
|
110
|
+
context.debug(`...validated the '${frameSubstitutionString}' frame subtitution's '${targetFrameString}' target frame...`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return targetFrameValidates;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
validateReplacementFrame(context) {
|
|
117
|
+
let replacementFrameValidates;
|
|
118
|
+
|
|
119
|
+
const replacementFrameString = this.replacementFrame.getString(),
|
|
120
|
+
frameSubstitutionString = this.getString(); ///
|
|
121
|
+
|
|
122
|
+
context.trace(`Validating the '${frameSubstitutionString}' frame subtitution's '${replacementFrameString}' replacement frame...`);
|
|
123
|
+
|
|
124
|
+
const stated = true,
|
|
125
|
+
assignments = null;
|
|
126
|
+
|
|
127
|
+
replacementFrameValidates = this.replacementFrame.validate(assignments, stated, context);
|
|
128
|
+
|
|
129
|
+
if (replacementFrameValidates) {
|
|
130
|
+
context.debug(`...validated the '${frameSubstitutionString}' frame subtitution's '${replacementFrameString}' replacement frame...`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return replacementFrameValidates;
|
|
77
134
|
}
|
|
78
135
|
|
|
79
136
|
static name = "FrameSubstitution";
|
|
@@ -86,18 +143,15 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
86
143
|
}
|
|
87
144
|
|
|
88
145
|
static fromFrameAndMetavariable(frame, metavariable, context) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
146
|
+
return literally((context) => {
|
|
147
|
+
const frameSubstitutionString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
|
|
148
|
+
string = frameSubstitutionString, ///
|
|
149
|
+
frameSubstitutionNode = instantiateFrameSubstitution(string, context),
|
|
150
|
+
frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
|
|
92
151
|
|
|
93
|
-
|
|
152
|
+
frameSubstitution.validate(context);
|
|
153
|
+
|
|
154
|
+
return frameSubstitution;
|
|
155
|
+
}, context);
|
|
94
156
|
}
|
|
95
157
|
});
|
|
96
|
-
|
|
97
|
-
function stringFromFrameAndMetavariable(frame, metavariable) {
|
|
98
|
-
const frameString = frame.getString(),
|
|
99
|
-
metavariableString = metavariable.getString(),
|
|
100
|
-
string = `[${frameString} for [${metavariableString}]]`;
|
|
101
|
-
|
|
102
|
-
return string;
|
|
103
|
-
}
|
|
@@ -3,42 +3,142 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
+
import { literally } from "../../utilities/context";
|
|
6
7
|
import { instantiateReferenceSubstitution } from "../../process/instantiate";
|
|
7
8
|
import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
|
|
9
|
+
import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
|
|
8
10
|
|
|
9
11
|
export default define(class ReferenceSubstitution extends Substitution {
|
|
10
|
-
constructor(context, string, node,
|
|
12
|
+
constructor(context, string, node, targetReference, replacementReference) {
|
|
11
13
|
super(context, string, node);
|
|
12
14
|
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
+
this.targetReference = targetReference;
|
|
16
|
+
this.replacementReference = replacementReference;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
return this.
|
|
19
|
+
getTargetReference() {
|
|
20
|
+
return this.targetReference;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
return this.
|
|
23
|
+
getReplacementReference() {
|
|
24
|
+
return this.replacementReference;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
getTargetNode() {
|
|
28
|
+
const targetReferenceNode = this.targetReference.getNode(),
|
|
29
|
+
tergetNode = targetReferenceNode; ///
|
|
30
|
+
|
|
31
|
+
return tergetNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
getReplacementNode() {
|
|
35
|
+
const replacementReferenceNode = this.replacementReference.getNode(),
|
|
36
|
+
replacementNode = replacementReferenceNode; ///
|
|
37
|
+
|
|
38
|
+
return replacementNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
isTrivial() {
|
|
42
|
+
const targetReferenceEqualToReplacementReference = this.targetReference.isEqualTo(this.replacementReference),
|
|
43
|
+
trivial = targetReferenceEqualToReplacementReference; ///
|
|
44
|
+
|
|
45
|
+
return trivial;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
compareReference(reference, context) {
|
|
49
|
+
const referenceEqualToReplacementReference = this.replacementReference.isEqualTo(reference),
|
|
50
|
+
comparedToReference = referenceEqualToReplacementReference; ///
|
|
51
|
+
|
|
52
|
+
return comparedToReference;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
compareParameter(parameter) {
|
|
56
|
+
const targetReferenceComparesToParameter = this.targetReference.compareParameter(parameter),
|
|
57
|
+
comparesToParameter = targetReferenceComparesToParameter; ///
|
|
58
|
+
|
|
59
|
+
return comparesToParameter;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
validate(context) {
|
|
63
|
+
let validates = false;
|
|
64
|
+
|
|
65
|
+
const referenceSubstitutionString = this.getString(); ///
|
|
66
|
+
|
|
67
|
+
context.trace(`Validating the '${referenceSubstitutionString}' reference substitution...`);
|
|
68
|
+
|
|
69
|
+
const targetReferenceValidates = this.validateTargetReference(context);
|
|
70
|
+
|
|
71
|
+
if (targetReferenceValidates) {
|
|
72
|
+
const replacementReferenceValidates = this.validateReplacementReference(context);
|
|
73
|
+
|
|
74
|
+
if (replacementReferenceValidates) {
|
|
75
|
+
validates = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (validates) {
|
|
80
|
+
const substititoin = this; ///
|
|
81
|
+
|
|
82
|
+
context.addSubstitution(substititoin);
|
|
83
|
+
|
|
84
|
+
context.debug(`...validated the '${referenceSubstitutionString}' reference substitution.`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return validates;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
validateTargetReference(context) {
|
|
91
|
+
let targetReferenceValidates = false;
|
|
92
|
+
|
|
93
|
+
const targetReferenceString = this.targetReference.getString(),
|
|
94
|
+
referenceSubstitutionString = this.getString(); ///
|
|
95
|
+
|
|
96
|
+
context.trace(`Validating the '${referenceSubstitutionString}' reference subtitution's '${targetReferenceString}' target reference...`);
|
|
97
|
+
|
|
98
|
+
const targetReferenceSingular = this.targetReference.isSingular();
|
|
99
|
+
|
|
100
|
+
if (targetReferenceSingular) {
|
|
101
|
+
targetReferenceValidates = this.targetReference.validate(context);
|
|
102
|
+
} else {
|
|
103
|
+
context.debug(`The '${referenceSubstitutionString}' reference subtitution's '${targetReferenceString}' target reference is not singular.`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (targetReferenceValidates) {
|
|
107
|
+
context.debug(`...validated the '${referenceSubstitutionString}' reference subtitution's '${targetReferenceString}' target reference...`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return targetReferenceValidates;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
validateReplacementReference(context) {
|
|
114
|
+
let replacementReferenceValidates;
|
|
115
|
+
|
|
116
|
+
const replacementReferenceString = this.replacementReference.getString(),
|
|
117
|
+
referenceSubstitutionString = this.getString(); ///
|
|
118
|
+
|
|
119
|
+
context.trace(`Validating the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference...`);
|
|
120
|
+
|
|
121
|
+
replacementReferenceValidates = this.replacementReference.validate(context);
|
|
122
|
+
|
|
123
|
+
if (replacementReferenceValidates) {
|
|
124
|
+
context.debug(`...validated the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference...`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return replacementReferenceValidates;
|
|
128
|
+
}
|
|
26
129
|
|
|
27
130
|
static name = "ReferenceSubstitution";
|
|
28
131
|
|
|
29
132
|
static fromReferenceAndMetavariable(reference, metavariable, context) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
133
|
+
return literally((context) => {
|
|
134
|
+
const referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
|
|
135
|
+
string = referenceSubstitutionString, ///
|
|
136
|
+
referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
|
|
137
|
+
referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
|
|
138
|
+
|
|
139
|
+
referenceSubstitution.validate(context);
|
|
33
140
|
|
|
34
|
-
|
|
141
|
+
return referenceSubstitution;
|
|
142
|
+
}, context);
|
|
35
143
|
}
|
|
36
144
|
});
|
|
37
|
-
|
|
38
|
-
function stringFromReferenceAndMetavariable(reference, metavariable) {
|
|
39
|
-
const referenceString = reference.getString(),
|
|
40
|
-
metavariableString = metavariable.getString(),
|
|
41
|
-
string = `[${referenceString} for ${metavariableString}]`;
|
|
42
|
-
|
|
43
|
-
return string;
|
|
44
|
-
}
|