occam-verify-cli 1.0.448 → 1.0.457
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants.js +1 -5
- package/lib/context/file.js +50 -78
- package/lib/context/fragment.js +77 -0
- package/lib/context/release.js +3 -3
- package/lib/context/scoped.js +314 -0
- package/lib/context/transient.js +371 -0
- package/lib/element/assumption.js +71 -84
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +11 -8
- package/lib/element/constructor/bracketed.js +1 -10
- package/lib/element/declaration/combinator.js +1 -2
- package/lib/element/declaration/metavariable.js +3 -3
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +18 -13
- package/lib/element/frame.js +40 -46
- package/lib/element/judgement.js +35 -56
- package/lib/element/metaType.js +5 -4
- package/lib/element/metavariable.js +6 -6
- package/lib/element/proof.js +4 -4
- package/lib/element/proofAssertion/premise.js +308 -0
- package/lib/element/proofAssertion/step.js +305 -0
- package/lib/element/proofAssertion/supposition.js +322 -0
- package/lib/element/proofAssertion.js +5 -9
- package/lib/element/reference.js +24 -23
- package/lib/element/rule.js +4 -4
- package/lib/element/section.js +4 -4
- package/lib/element/statement.js +2 -7
- package/lib/element/subproof.js +4 -4
- package/lib/element/substitution/frame.js +7 -7
- package/lib/element/substitution/statement.js +15 -39
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +12 -10
- package/lib/element/topLevelAssertion/axiom.js +329 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/element/topLevelAssertion.js +427 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/element/topLevelMetaAssertion.js +289 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +20 -20
- package/lib/metaTypes.js +18 -15
- package/lib/node/proofAssertion/premise.js +116 -0
- package/lib/node/proofAssertion/step.js +152 -0
- package/lib/node/proofAssertion/supposition.js +116 -0
- package/lib/node/{premise.js → proofAssertion.js} +11 -18
- package/lib/node/statement.js +2 -2
- package/lib/node/substitution/statement.js +2 -2
- package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
- package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
- package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
- package/lib/nonTerminalNodeMap.js +13 -13
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -9
- package/lib/process/unify.js +7 -6
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/context.js +28 -0
- package/lib/utilities/element.js +101 -99
- package/lib/utilities/fragment.js +23 -0
- package/lib/utilities/instance.js +12 -34
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +42 -21
- package/lib/utilities/unification.js +17 -17
- package/lib/utilities/validation.js +22 -25
- package/package.json +2 -2
- package/src/constants.js +0 -1
- package/src/context/file.js +48 -55
- package/src/context/fragment.js +38 -0
- package/src/context/release.js +4 -2
- package/src/context/{local.js → scoped.js} +8 -100
- package/src/context/{temporary.js → transient.js} +9 -131
- package/src/element/assumption.js +69 -85
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +14 -10
- package/src/element/constructor/bracketed.js +0 -7
- package/src/element/declaration/combinator.js +0 -1
- package/src/element/declaration/metavariable.js +2 -2
- package/src/element/declaration/variable.js +5 -5
- package/src/element/deduction.js +22 -15
- package/src/element/frame.js +36 -48
- package/src/element/judgement.js +33 -58
- package/src/element/metaType.js +4 -4
- package/src/element/metavariable.js +8 -6
- package/src/element/proof.js +3 -3
- package/src/element/{premise.js → proofAssertion/premise.js} +23 -23
- package/src/element/{step.js → proofAssertion/step.js} +32 -40
- package/src/element/{supposition.js → proofAssertion/supposition.js} +24 -24
- package/src/element/proofAssertion.js +6 -13
- package/src/element/reference.js +23 -21
- package/src/element/rule.js +3 -3
- package/src/element/section.js +4 -4
- package/src/element/statement.js +2 -9
- package/src/element/subproof.js +3 -3
- package/src/element/substitution/frame.js +10 -13
- package/src/element/substitution/statement.js +20 -52
- package/src/element/substitution.js +3 -3
- package/src/element/term.js +10 -9
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +15 -15
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -7
- package/src/element/type.js +2 -4
- package/src/element/variable.js +17 -17
- package/src/metaTypes.js +25 -9
- package/src/node/proofAssertion/premise.js +16 -0
- package/src/node/{step.js → proofAssertion/step.js} +4 -18
- package/src/node/proofAssertion/supposition.js +16 -0
- package/src/node/proofAssertion.js +23 -0
- package/src/node/statement.js +1 -1
- package/src/node/substitution/statement.js +1 -1
- package/src/node/topLevelAssertion/axiom.js +13 -0
- package/src/node/topLevelAssertion/conjecture.js +13 -0
- package/src/node/topLevelAssertion/lemma.js +13 -0
- package/src/node/topLevelAssertion/theorem.js +13 -0
- package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
- package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
- package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
- package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
- package/src/nonTerminalNodeMap.js +12 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +31 -32
- package/src/process/unify.js +6 -5
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/context.js +20 -0
- package/src/utilities/element.js +169 -162
- package/src/utilities/fragment.js +11 -0
- package/src/utilities/instance.js +19 -42
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +53 -28
- package/src/utilities/unification.js +16 -16
- package/src/utilities/validation.js +26 -35
- package/lib/context/local.js +0 -605
- package/lib/context/temporary.js +0 -752
- package/lib/element/axiom.js +0 -329
- package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
- package/lib/element/metaLemmaMetatheorem.js +0 -289
- package/lib/element/premise.js +0 -307
- package/lib/element/step.js +0 -311
- package/lib/element/supposition.js +0 -320
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- package/src/node/axiom.js +0 -13
- package/src/node/conjecture.js +0 -13
- package/src/node/lemma.js +0 -13
- package/src/node/metaLemma.js +0 -13
- package/src/node/metatheorem.js +0 -13
- package/src/node/premise.js +0 -30
- package/src/node/supposition.js +0 -30
- package/src/node/theorem.js +0 -13
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import elements from "
|
|
4
|
-
import ProofAssertion from "
|
|
5
|
-
import
|
|
3
|
+
import elements from "../../elements";
|
|
4
|
+
import ProofAssertion from "../proofAssertion";
|
|
5
|
+
import TransientContext from "../../context/transient";
|
|
6
6
|
|
|
7
|
-
import { define } from "
|
|
8
|
-
import { unifyStatements } from "
|
|
9
|
-
import { propertyAssertionFromStatement } from "
|
|
7
|
+
import { define } from "../../elements";
|
|
8
|
+
import { unifyStatements } from "../../utilities/unification";
|
|
9
|
+
import { propertyAssertionFromStatement } from "../../utilities/statement";
|
|
10
10
|
|
|
11
11
|
export default define(class Step extends ProofAssertion {
|
|
12
12
|
constructor(context, string, node, statement, reference, satisfiesAssertion) {
|
|
@@ -59,9 +59,9 @@ export default define(class Step extends ProofAssertion {
|
|
|
59
59
|
verify(substitutions, assignments, context) {
|
|
60
60
|
let verifies = false;
|
|
61
61
|
|
|
62
|
-
const
|
|
62
|
+
const transientContext = TransientContext.fromNothing(context);
|
|
63
63
|
|
|
64
|
-
context =
|
|
64
|
+
context = transientContext; ///
|
|
65
65
|
|
|
66
66
|
const node = this.getNode(),
|
|
67
67
|
stepString = this.getString(); ///
|
|
@@ -73,9 +73,9 @@ export default define(class Step extends ProofAssertion {
|
|
|
73
73
|
if (statement === null) {
|
|
74
74
|
context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
|
|
75
75
|
} else {
|
|
76
|
-
const
|
|
76
|
+
const referenceValidates = this.validateReference(context);
|
|
77
77
|
|
|
78
|
-
if (
|
|
78
|
+
if (referenceValidates) {
|
|
79
79
|
const satisfiesAssertioVeriries = this.verifySatisfiesAssertion(context);
|
|
80
80
|
|
|
81
81
|
if (satisfiesAssertioVeriries) {
|
|
@@ -92,12 +92,6 @@ export default define(class Step extends ProofAssertion {
|
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
if (statementUnifies) {
|
|
95
|
-
const subproofOrProofAssertion = this; ///
|
|
96
|
-
|
|
97
|
-
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
98
|
-
|
|
99
|
-
this.setContext(context);
|
|
100
|
-
|
|
101
95
|
verifies = true;
|
|
102
96
|
}
|
|
103
97
|
}
|
|
@@ -106,52 +100,50 @@ export default define(class Step extends ProofAssertion {
|
|
|
106
100
|
}
|
|
107
101
|
|
|
108
102
|
if (verifies) {
|
|
103
|
+
this.setContext(context);
|
|
104
|
+
|
|
109
105
|
context.debug(`...verified the '${stepString}' step.`, node);
|
|
110
106
|
}
|
|
111
107
|
|
|
112
108
|
return verifies;
|
|
113
109
|
}
|
|
114
110
|
|
|
115
|
-
|
|
116
|
-
let
|
|
111
|
+
validateReference(context) {
|
|
112
|
+
let referenceValidates = true;
|
|
117
113
|
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
if (this.reference !== null) {
|
|
115
|
+
const node = this.getNode(),
|
|
116
|
+
stepString = this.getString();
|
|
120
117
|
|
|
121
|
-
|
|
118
|
+
context.trace(`Validating the '${stepString}' step's reference... `, node);
|
|
122
119
|
|
|
123
|
-
|
|
124
|
-
referenceVeriries = this.reference.verify(context);
|
|
125
|
-
} else {
|
|
126
|
-
referenceVeriries = true;
|
|
127
|
-
}
|
|
120
|
+
referenceValidates = this.reference.validate(context);
|
|
128
121
|
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
if (referenceValidates) {
|
|
123
|
+
context.debug(`...validating the '${stepString}' step's reference. `, node);
|
|
124
|
+
}
|
|
131
125
|
}
|
|
132
126
|
|
|
133
|
-
return
|
|
127
|
+
return referenceValidates;
|
|
134
128
|
}
|
|
135
129
|
|
|
136
130
|
verifySatisfiesAssertion(context) {
|
|
137
|
-
let satisfiesAssertionVerifies;
|
|
131
|
+
let satisfiesAssertionVerifies = true; ///
|
|
138
132
|
|
|
139
|
-
|
|
140
|
-
|
|
133
|
+
if (this.satisfiesAssertion !== null) {
|
|
134
|
+
const node = this.getNode(),
|
|
135
|
+
stepString = this.getString(); ///
|
|
141
136
|
|
|
142
|
-
|
|
137
|
+
context.trace(`Verifying the '${stepString}' step's satisfies assertion... `, node);
|
|
143
138
|
|
|
144
|
-
if (this.satisfiesAssertion !== null) {
|
|
145
139
|
const stated = true,
|
|
146
140
|
assignments = null;
|
|
147
141
|
|
|
148
142
|
satisfiesAssertionVerifies = this.satisfiesAssertion.validate(assignments, stated, context);
|
|
149
|
-
} else {
|
|
150
|
-
satisfiesAssertionVerifies = true;
|
|
151
|
-
}
|
|
152
143
|
|
|
153
|
-
|
|
154
|
-
|
|
144
|
+
if (satisfiesAssertionVerifies) {
|
|
145
|
+
context.debug(`...verified the '${stepString}' step's satisfies assertion. `, node);
|
|
146
|
+
}
|
|
155
147
|
}
|
|
156
148
|
|
|
157
149
|
return satisfiesAssertionVerifies;
|
|
@@ -160,7 +152,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
160
152
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
161
153
|
let unifiesWithSatisfiesAssertion = false;
|
|
162
154
|
|
|
163
|
-
const stepString = this.
|
|
155
|
+
const stepString = this.getString(), ///
|
|
164
156
|
satisfiesAssertionString = satisfiesAssertion.getString();
|
|
165
157
|
|
|
166
158
|
context.trace(`Unifying the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion...`, this.node);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import ProofAssertion from "
|
|
4
|
-
import
|
|
5
|
-
import assignAssignments from "
|
|
3
|
+
import ProofAssertion from "../proofAssertion";
|
|
4
|
+
import TransientContext from "../../context/transient";
|
|
5
|
+
import assignAssignments from "../../process/assign";
|
|
6
6
|
|
|
7
|
-
import { define } from "
|
|
8
|
-
import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "
|
|
7
|
+
import { define } from "../../elements";
|
|
8
|
+
import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../../utilities/json";
|
|
9
9
|
|
|
10
10
|
export default define(class Supposition extends ProofAssertion {
|
|
11
11
|
constructor(context, string, node, statement, procedureCall) {
|
|
12
|
-
super(context, string, node);
|
|
12
|
+
super(context, string, node, statement);
|
|
13
13
|
|
|
14
14
|
this.procedureCall = procedureCall;
|
|
15
15
|
}
|
|
@@ -21,9 +21,9 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
21
21
|
verify(context) {
|
|
22
22
|
let verifies = false;
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const transientContext = TransientContext.fromNothing(context);
|
|
25
25
|
|
|
26
|
-
context =
|
|
26
|
+
context = transientContext; ///
|
|
27
27
|
|
|
28
28
|
const node = this.getNode(),
|
|
29
29
|
suppositionString = this.getString(); ///
|
|
@@ -76,10 +76,9 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
76
76
|
unifyIndependently(substitutions, context) {
|
|
77
77
|
let unifiesIndependently = false;
|
|
78
78
|
|
|
79
|
-
const
|
|
80
|
-
suppositionString = this.getString();
|
|
79
|
+
const suppositionString = this.getString();
|
|
81
80
|
|
|
82
|
-
context.trace(`Unifying the '${suppositionString}' supposition independently
|
|
81
|
+
context.trace(`Unifying the '${suppositionString}' supposition independently...`);
|
|
83
82
|
|
|
84
83
|
const specificContext = context; ///
|
|
85
84
|
|
|
@@ -108,7 +107,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
if (unifiesIndependently) {
|
|
111
|
-
context.debug(`...unified the '${suppositionString}' supposition independenly
|
|
110
|
+
context.debug(`...unified the '${suppositionString}' supposition independenly.`);
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
return unifiesIndependently;
|
|
@@ -155,34 +154,35 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
158
|
-
let
|
|
157
|
+
let proofAssertionUnifies = false;
|
|
159
158
|
|
|
160
|
-
const
|
|
161
|
-
suppositionString = this.getString(),
|
|
159
|
+
const suppositionString = this.getString(),
|
|
162
160
|
proofAssertionString = proofAssertion.getString();
|
|
163
161
|
|
|
164
|
-
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition
|
|
165
|
-
|
|
166
|
-
const specificContext = context; ///
|
|
162
|
+
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`);
|
|
167
163
|
|
|
168
164
|
context = this.getContext();
|
|
169
165
|
|
|
170
166
|
const generalContext = context; ///
|
|
171
167
|
|
|
168
|
+
context = proofAssertion.getContext();
|
|
169
|
+
|
|
170
|
+
const specificContext = context; ///
|
|
171
|
+
|
|
172
172
|
context = specificContext; ///
|
|
173
173
|
|
|
174
174
|
const statement = proofAssertion.getStatement(),
|
|
175
175
|
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
176
176
|
|
|
177
177
|
if (statementUnifies) {
|
|
178
|
-
|
|
178
|
+
proofAssertionUnifies = true;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
if (
|
|
182
|
-
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition
|
|
181
|
+
if (proofAssertionUnifies) {
|
|
182
|
+
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
return
|
|
185
|
+
return proofAssertionUnifies;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
unifySubproof(subproof, substitutions, context) {
|
|
@@ -287,7 +287,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
287
287
|
frames = framesFromJSON(json, context),
|
|
288
288
|
statement = statementFromJSON(json, context),
|
|
289
289
|
procedureCall = procedureCallFromJSON(json, context),
|
|
290
|
-
|
|
290
|
+
transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
|
|
291
291
|
|
|
292
292
|
let string;
|
|
293
293
|
|
|
@@ -301,7 +301,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
301
301
|
|
|
302
302
|
const node = null;
|
|
303
303
|
|
|
304
|
-
context =
|
|
304
|
+
context = transientContext; ///
|
|
305
305
|
|
|
306
306
|
const supposition = new Supposition(context, string, node, statement, procedureCall);
|
|
307
307
|
|
|
@@ -46,28 +46,21 @@ export default class ProofAssertion extends Element {
|
|
|
46
46
|
return comparesToStatement;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
unifyStatement(statement, substitutions,
|
|
49
|
+
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
50
50
|
let statementUnifies = false;
|
|
51
51
|
|
|
52
52
|
if (this.statement !== null) {
|
|
53
53
|
const node = this.getNode(),
|
|
54
|
-
|
|
55
|
-
statementString = statement.getString()
|
|
54
|
+
context = specificContext, ///
|
|
55
|
+
statementString = statement.getString(),
|
|
56
|
+
proorAssertionString = this.getString(); ///
|
|
56
57
|
|
|
57
|
-
context.trace(`Unifying the '${statementString}' statement with the '${
|
|
58
|
-
|
|
59
|
-
const specificContext = context; ///
|
|
60
|
-
|
|
61
|
-
context = this.getContext(); ///
|
|
62
|
-
|
|
63
|
-
const generalContext = context; ///
|
|
64
|
-
|
|
65
|
-
context = specificContext; ///
|
|
58
|
+
context.trace(`Unifying the '${statementString}' statement with the '${proorAssertionString}' proof assertion...`, node);
|
|
66
59
|
|
|
67
60
|
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
68
61
|
|
|
69
62
|
if (statementUnifies) {
|
|
70
|
-
context.debug(`...unified the '${statementString}' statement with the '${
|
|
63
|
+
context.debug(`...unified the '${statementString}' statement with the '${proorAssertionString}' proof assertion.`, node);
|
|
71
64
|
}
|
|
72
65
|
}
|
|
73
66
|
|
package/src/element/reference.js
CHANGED
|
@@ -4,7 +4,8 @@ import Element from "../element";
|
|
|
4
4
|
import elements from "../elements";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
|
|
8
|
+
import { findMetaTypeByMetaTypeName } from "../metaTypes";
|
|
8
9
|
import { unifyMetavariableIntrinsically } from "../process/unify";
|
|
9
10
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
10
11
|
|
|
@@ -39,41 +40,42 @@ export default define(class Reference extends Element {
|
|
|
39
40
|
|
|
40
41
|
matchMetavariableNode(metavariableNode) { return this.metavariable.matchNode(metavariableNode); }
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
let
|
|
43
|
+
validate(context) {
|
|
44
|
+
let validate = false;
|
|
44
45
|
|
|
45
46
|
const referenceString = this.getString(); ///
|
|
46
47
|
|
|
47
|
-
context.trace(`
|
|
48
|
+
context.trace(`Validating the '${referenceString}' reference...`);
|
|
48
49
|
|
|
49
|
-
if (!
|
|
50
|
+
if (!validate) {
|
|
50
51
|
const metavariableValidates = this.validateMetavariable(context);
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
validate = metavariableValidates; ///
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
if (!
|
|
56
|
+
if (!validate) {
|
|
56
57
|
const reference = this, ///
|
|
57
58
|
labelPresent = context.isLabelPresentByReference(reference);
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
validate = labelPresent; ///
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
if (
|
|
63
|
+
if (validate) {
|
|
63
64
|
const reference = this; ///
|
|
64
65
|
|
|
65
66
|
context.addReference(reference);
|
|
66
67
|
|
|
67
|
-
context.debug(`...
|
|
68
|
+
context.debug(`...validated the '${referenceString}' reference.`);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
return
|
|
71
|
+
return validate;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
validateMetavariable(context) {
|
|
74
75
|
let metavariableValidates = false;
|
|
75
76
|
|
|
76
|
-
const
|
|
77
|
+
const metaTypeName = REFERENCE_META_TYPE_NAME,
|
|
78
|
+
referenceMetaType = findMetaTypeByMetaTypeName(metaTypeName),
|
|
77
79
|
metaType = referenceMetaType, ///
|
|
78
80
|
metavariableValidatesGivenMetaType = this.metavariable.validateGivenMetaType(metaType, context);
|
|
79
81
|
|
|
@@ -141,27 +143,27 @@ export default define(class Reference extends Element {
|
|
|
141
143
|
return metavariableUnifies;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
let
|
|
146
|
+
unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
|
|
147
|
+
let topLevelMetaAssertionUnifies;
|
|
146
148
|
|
|
147
149
|
const reference = this, ///
|
|
148
150
|
referenceString = reference.getString(),
|
|
149
|
-
|
|
151
|
+
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
150
152
|
|
|
151
|
-
context.trace(`Unifying the '${
|
|
153
|
+
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
|
|
152
154
|
|
|
153
155
|
const { Substitutions } = elements,
|
|
154
|
-
label =
|
|
156
|
+
label = topLevelMetaAssertion.getLabel(),
|
|
155
157
|
substitutions = Substitutions.fromNothing(),
|
|
156
158
|
labelUnifies = this.unifyLabel(label, substitutions, context);
|
|
157
159
|
|
|
158
|
-
|
|
160
|
+
topLevelMetaAssertionUnifies = labelUnifies; ///
|
|
159
161
|
|
|
160
|
-
if (
|
|
161
|
-
context.trace(`...unified the '${
|
|
162
|
+
if (topLevelMetaAssertionUnifies) {
|
|
163
|
+
context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference.`);
|
|
162
164
|
}
|
|
163
165
|
|
|
164
|
-
return
|
|
166
|
+
return topLevelMetaAssertionUnifies;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
toJSON() {
|
package/src/element/rule.js
CHANGED
|
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import Element from "../element";
|
|
6
6
|
import elements from "../elements";
|
|
7
|
-
import
|
|
7
|
+
import ScopedContext from "../context/scoped";
|
|
8
8
|
|
|
9
9
|
import { define } from "../elements";
|
|
10
10
|
import { labelsFromJSON,
|
|
@@ -70,9 +70,9 @@ export default define(class Rule extends Element {
|
|
|
70
70
|
const labelsVerify = this.verifyLabels();
|
|
71
71
|
|
|
72
72
|
if (labelsVerify) {
|
|
73
|
-
const
|
|
73
|
+
const scopedContext = ScopedContext.fromNothing(context);
|
|
74
74
|
|
|
75
|
-
context =
|
|
75
|
+
context = scopedContext; ///
|
|
76
76
|
|
|
77
77
|
const premisesVerify = this.verifyPremises(context);
|
|
78
78
|
|
package/src/element/section.js
CHANGED
|
@@ -45,11 +45,11 @@ export default define(class Section extends Element {
|
|
|
45
45
|
const hypothesesVerify = this.verifyHypotheses();
|
|
46
46
|
|
|
47
47
|
if (hypothesesVerify) {
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const topLevelAssertion = (this.axiom || this.lemma || this.theorem || this.conjecture),
|
|
49
|
+
topLevelAssertionVerifies = topLevelAssertion.verify(this.context);
|
|
50
50
|
|
|
51
|
-
if (
|
|
52
|
-
|
|
51
|
+
if (topLevelAssertionVerifies) {
|
|
52
|
+
topLevelAssertion.setHypotheses(this.hypotheses);
|
|
53
53
|
|
|
54
54
|
verifies = true;
|
|
55
55
|
}
|
package/src/element/statement.js
CHANGED
|
@@ -18,15 +18,8 @@ export default define(class Statement extends Element {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getMetavariableName() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const singular = this.isSingular();
|
|
24
|
-
|
|
25
|
-
if (singular) {
|
|
26
|
-
const node = this.getNode();
|
|
27
|
-
|
|
28
|
-
metavariableName = node.getMetavariableName();
|
|
29
|
-
}
|
|
21
|
+
const node = this.getNode(),
|
|
22
|
+
metavariableName = node.getMetavariableName();
|
|
30
23
|
|
|
31
24
|
return metavariableName;
|
|
32
25
|
}
|
package/src/element/subproof.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
4
|
import elements from "../elements";
|
|
5
|
-
import
|
|
5
|
+
import ScopedContext from "../context/scoped";
|
|
6
6
|
|
|
7
7
|
import { define } from "../elements";
|
|
8
8
|
|
|
@@ -49,9 +49,9 @@ export default define(class Subproof extends Element {
|
|
|
49
49
|
verify(substitutions, assignments, context) {
|
|
50
50
|
let verifies = false;
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const scopedContext = ScopedContext.fromNothing(context); ///
|
|
53
53
|
|
|
54
|
-
context =
|
|
54
|
+
context = scopedContext; ///
|
|
55
55
|
|
|
56
56
|
const suppositionsVerify = this.suppositions.every((supposition) => {
|
|
57
57
|
const suppositionVerifies = supposition.verify(context);
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
import Substitution from "../substitution";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
+
import { withinFragment } from "../../utilities/fragment";
|
|
6
7
|
import { instantiateFrameSubstitution } from "../../process/instantiate";
|
|
8
|
+
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
7
9
|
import { frameSubstitutionFromFrameSubstitutionNode, frameSubstitutionFromStatementNode } from "../../utilities/element";
|
|
8
10
|
|
|
9
11
|
export default define(class FrameSubstitution extends Substitution {
|
|
@@ -86,18 +88,13 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
static fromFrameAndMetavariable(frame, metavariable, context) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
return withinFragment((context) => {
|
|
92
|
+
const frameAndMetavariableString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
|
|
93
|
+
string = frameAndMetavariableString, ///
|
|
94
|
+
frameSubstitutionNode = instantiateFrameSubstitution(string, context),
|
|
95
|
+
frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
|
|
96
|
+
|
|
97
|
+
return frameSubstitution;
|
|
98
|
+
}, context);
|
|
94
99
|
}
|
|
95
100
|
});
|
|
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
|
-
}
|
|
@@ -4,11 +4,13 @@ import elements from "../../elements";
|
|
|
4
4
|
import Substitution from "../substitution";
|
|
5
5
|
|
|
6
6
|
import { define } from "../../elements";
|
|
7
|
+
import { withinFragment } from "../../utilities/fragment";
|
|
7
8
|
import { unifySubstitution } from "../../process/unify";
|
|
8
9
|
import { stripBracketsFromStatement } from "../../utilities/brackets";
|
|
9
10
|
import { instantiateStatementSubstitution } from "../../process/instantiate";
|
|
10
11
|
import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
|
|
11
12
|
import { statementFromJSON, statementToStatementJSON, metavariableFromJSON, metavariableToMetavariableJSON } from "../../utilities/json";
|
|
13
|
+
import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
|
|
12
14
|
|
|
13
15
|
export default define(class StatementSubstitution extends Substitution {
|
|
14
16
|
constructor(context, string, node, resolved, statement, metavariable, substitution) {
|
|
@@ -73,12 +75,13 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
73
75
|
return substitutionEqualToSubstitution;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
compareStatesment(statement, context) {
|
|
77
79
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
78
80
|
|
|
79
|
-
const statementEqualToStatement = this.statement.isEqualTo(statement)
|
|
81
|
+
const statementEqualToStatement = this.statement.isEqualTo(statement),
|
|
82
|
+
comparesToStatement = statementEqualToStatement; ///
|
|
80
83
|
|
|
81
|
-
return
|
|
84
|
+
return comparesToStatement;
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
isSimple() {
|
|
@@ -214,18 +217,14 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
214
217
|
static fromStatementAndMetavariable(statement, metavariable, context) {
|
|
215
218
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
216
219
|
|
|
217
|
-
const
|
|
218
|
-
|
|
220
|
+
const statementSubstitution = withinFragment((context) => {
|
|
221
|
+
const statementSubstitutionString = statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable, context),
|
|
222
|
+
string = statementSubstitutionString, ///
|
|
223
|
+
statementSubstitutionNode = instantiateStatementSubstitution(string, context),
|
|
224
|
+
statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context)
|
|
219
225
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
|
|
225
|
-
|
|
226
|
-
statementSubstitution.setStatement(statement);
|
|
227
|
-
|
|
228
|
-
statementSubstitution.setMetavariable(metavariable);
|
|
226
|
+
return statementSubstitution;
|
|
227
|
+
}, context);
|
|
229
228
|
|
|
230
229
|
return statementSubstitution;
|
|
231
230
|
}
|
|
@@ -233,46 +232,15 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
233
232
|
static fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) {
|
|
234
233
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
235
234
|
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
};
|
|
235
|
+
const statementSubstitution = withinFragment((context) => {
|
|
236
|
+
const statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
|
|
237
|
+
string = statementSubstitutionString, ///
|
|
238
|
+
statementSubstitutionNode = instantiateStatementSubstitution(string, context),
|
|
239
|
+
statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context)
|
|
242
240
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
statementSubstitution.setStatement(statement);
|
|
246
|
-
|
|
247
|
-
statementSubstitution.setMetavariable(metavariable);
|
|
248
|
-
|
|
249
|
-
statementSubstitution.setSubstitution(substitution);
|
|
241
|
+
return statementSubstitution;
|
|
242
|
+
}, context);
|
|
250
243
|
|
|
251
244
|
return statementSubstitution;
|
|
252
245
|
}
|
|
253
246
|
});
|
|
254
|
-
|
|
255
|
-
function stringFromStatementAndMetavariable(statement, metavariable) {
|
|
256
|
-
const statementString = statement.getString(),
|
|
257
|
-
metavariableString = metavariable.getString(),
|
|
258
|
-
string = `[${statementString} for ${metavariableString}]`;
|
|
259
|
-
|
|
260
|
-
return string;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function stringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution) {
|
|
264
|
-
let string;
|
|
265
|
-
|
|
266
|
-
const statementString = statement.getString(),
|
|
267
|
-
metavariableString = metavariable.getString();
|
|
268
|
-
|
|
269
|
-
if (substitution === null) {
|
|
270
|
-
string = `[${statementString} for ${metavariableString}]`;
|
|
271
|
-
} else {
|
|
272
|
-
const substitutionString = substitution.getString();
|
|
273
|
-
|
|
274
|
-
string = `[${statementString} for ${metavariableString}${substitutionString}]`;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
return string;
|
|
278
|
-
}
|
|
@@ -92,10 +92,10 @@ export default class Substitution extends Element {
|
|
|
92
92
|
return referenceEqualToReference;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
const
|
|
95
|
+
compareStatement(statement, context) {
|
|
96
|
+
const comparesToStatement = false;
|
|
97
97
|
|
|
98
|
-
return
|
|
98
|
+
return comparesToStatement;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
isMetavariableEqualToMetavariable(metavariable) {
|