occam-verify-cli 1.0.448 → 1.0.457
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants.js +1 -5
- package/lib/context/file.js +50 -78
- package/lib/context/fragment.js +77 -0
- package/lib/context/release.js +3 -3
- package/lib/context/scoped.js +314 -0
- package/lib/context/transient.js +371 -0
- package/lib/element/assumption.js +71 -84
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +11 -8
- package/lib/element/constructor/bracketed.js +1 -10
- package/lib/element/declaration/combinator.js +1 -2
- package/lib/element/declaration/metavariable.js +3 -3
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +18 -13
- package/lib/element/frame.js +40 -46
- package/lib/element/judgement.js +35 -56
- package/lib/element/metaType.js +5 -4
- package/lib/element/metavariable.js +6 -6
- package/lib/element/proof.js +4 -4
- package/lib/element/proofAssertion/premise.js +308 -0
- package/lib/element/proofAssertion/step.js +305 -0
- package/lib/element/proofAssertion/supposition.js +322 -0
- package/lib/element/proofAssertion.js +5 -9
- package/lib/element/reference.js +24 -23
- package/lib/element/rule.js +4 -4
- package/lib/element/section.js +4 -4
- package/lib/element/statement.js +2 -7
- package/lib/element/subproof.js +4 -4
- package/lib/element/substitution/frame.js +7 -7
- package/lib/element/substitution/statement.js +15 -39
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +12 -10
- package/lib/element/topLevelAssertion/axiom.js +329 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/element/topLevelAssertion.js +427 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/element/topLevelMetaAssertion.js +289 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +20 -20
- package/lib/metaTypes.js +18 -15
- package/lib/node/proofAssertion/premise.js +116 -0
- package/lib/node/proofAssertion/step.js +152 -0
- package/lib/node/proofAssertion/supposition.js +116 -0
- package/lib/node/{premise.js → proofAssertion.js} +11 -18
- package/lib/node/statement.js +2 -2
- package/lib/node/substitution/statement.js +2 -2
- package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
- package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
- package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
- package/lib/nonTerminalNodeMap.js +13 -13
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -9
- package/lib/process/unify.js +7 -6
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/context.js +28 -0
- package/lib/utilities/element.js +101 -99
- package/lib/utilities/fragment.js +23 -0
- package/lib/utilities/instance.js +12 -34
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +42 -21
- package/lib/utilities/unification.js +17 -17
- package/lib/utilities/validation.js +22 -25
- package/package.json +2 -2
- package/src/constants.js +0 -1
- package/src/context/file.js +48 -55
- package/src/context/fragment.js +38 -0
- package/src/context/release.js +4 -2
- package/src/context/{local.js → scoped.js} +8 -100
- package/src/context/{temporary.js → transient.js} +9 -131
- package/src/element/assumption.js +69 -85
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +14 -10
- package/src/element/constructor/bracketed.js +0 -7
- package/src/element/declaration/combinator.js +0 -1
- package/src/element/declaration/metavariable.js +2 -2
- package/src/element/declaration/variable.js +5 -5
- package/src/element/deduction.js +22 -15
- package/src/element/frame.js +36 -48
- package/src/element/judgement.js +33 -58
- package/src/element/metaType.js +4 -4
- package/src/element/metavariable.js +8 -6
- package/src/element/proof.js +3 -3
- package/src/element/{premise.js → proofAssertion/premise.js} +23 -23
- package/src/element/{step.js → proofAssertion/step.js} +32 -40
- package/src/element/{supposition.js → proofAssertion/supposition.js} +24 -24
- package/src/element/proofAssertion.js +6 -13
- package/src/element/reference.js +23 -21
- package/src/element/rule.js +3 -3
- package/src/element/section.js +4 -4
- package/src/element/statement.js +2 -9
- package/src/element/subproof.js +3 -3
- package/src/element/substitution/frame.js +10 -13
- package/src/element/substitution/statement.js +20 -52
- package/src/element/substitution.js +3 -3
- package/src/element/term.js +10 -9
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +15 -15
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -7
- package/src/element/type.js +2 -4
- package/src/element/variable.js +17 -17
- package/src/metaTypes.js +25 -9
- package/src/node/proofAssertion/premise.js +16 -0
- package/src/node/{step.js → proofAssertion/step.js} +4 -18
- package/src/node/proofAssertion/supposition.js +16 -0
- package/src/node/proofAssertion.js +23 -0
- package/src/node/statement.js +1 -1
- package/src/node/substitution/statement.js +1 -1
- package/src/node/topLevelAssertion/axiom.js +13 -0
- package/src/node/topLevelAssertion/conjecture.js +13 -0
- package/src/node/topLevelAssertion/lemma.js +13 -0
- package/src/node/topLevelAssertion/theorem.js +13 -0
- package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
- package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
- package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
- package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
- package/src/nonTerminalNodeMap.js +12 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +31 -32
- package/src/process/unify.js +6 -5
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/context.js +20 -0
- package/src/utilities/element.js +169 -162
- package/src/utilities/fragment.js +11 -0
- package/src/utilities/instance.js +19 -42
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +53 -28
- package/src/utilities/unification.js +16 -16
- package/src/utilities/validation.js +26 -35
- package/lib/context/local.js +0 -605
- package/lib/context/temporary.js +0 -752
- package/lib/element/axiom.js +0 -329
- package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
- package/lib/element/metaLemmaMetatheorem.js +0 -289
- package/lib/element/premise.js +0 -307
- package/lib/element/step.js +0 -311
- package/lib/element/supposition.js +0 -320
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- package/src/node/axiom.js +0 -13
- package/src/node/conjecture.js +0 -13
- package/src/node/lemma.js +0 -13
- package/src/node/metaLemma.js +0 -13
- package/src/node/metatheorem.js +0 -13
- package/src/node/premise.js +0 -30
- package/src/node/supposition.js +0 -30
- package/src/node/theorem.js +0 -13
package/src/utilities/element.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import elements from "../elements";
|
|
4
|
+
import FragmentContext from "../context/fragment";
|
|
4
5
|
|
|
5
6
|
import { baseTypeFromNothing } from "../types";
|
|
6
7
|
import { instantiateReference } from "../process/instantiate";
|
|
8
|
+
import { findMetaTypeByMetaTypeName } from "../metaTypes";
|
|
7
9
|
import { equivalenceStringFromTerms,
|
|
8
10
|
rulsStringFromLabelsPremisesAndConclusion,
|
|
11
|
+
sectionStringFromHypothesesTopLevelAssertion,
|
|
9
12
|
subproofStringFromSuppositionsAndSubDerivation,
|
|
10
13
|
procedureCallStringFromProcedureReferenceAndParameters,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
axiomLemmaTheoremConjectureStringFromLabelsSuppositionsAndDeduction } from "../utilities/string";
|
|
14
|
+
topLevelAssertionStringFromLabelsSuppositionsAndDeduction,
|
|
15
|
+
topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction } from "../utilities/string";
|
|
14
16
|
|
|
15
17
|
export function typeFromTypeNode(typeNode, context) {
|
|
16
18
|
let type;
|
|
@@ -98,16 +100,16 @@ export function errorFromErrorNode(errorNode, context) {
|
|
|
98
100
|
|
|
99
101
|
export function lemmaFromLemmaNode(lemmaNode, context) {
|
|
100
102
|
const { Lemma } = elements,
|
|
101
|
-
|
|
102
|
-
proof =
|
|
103
|
-
labels =
|
|
104
|
-
deduction =
|
|
105
|
-
suppositions =
|
|
106
|
-
signature =
|
|
103
|
+
topLevelAsssertionNode = lemmaNode, ///
|
|
104
|
+
proof = proofFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
105
|
+
labels = labelsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
106
|
+
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
107
|
+
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
108
|
+
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
107
109
|
hypotheses = [],
|
|
108
|
-
|
|
110
|
+
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
109
111
|
node = lemmaNode, ///
|
|
110
|
-
string =
|
|
112
|
+
string = topLevelAsssertionString, ///
|
|
111
113
|
lemma = new Lemma(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
112
114
|
|
|
113
115
|
return lemma;
|
|
@@ -115,10 +117,10 @@ export function lemmaFromLemmaNode(lemmaNode, context) {
|
|
|
115
117
|
|
|
116
118
|
export function frameFromFrameNode(frameNode, context) {
|
|
117
119
|
const { Frame } = elements,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
node = frameNode, ///
|
|
121
|
+
string = context.nodeAsString(node),
|
|
122
|
+
assumptions = assumptionsFromFrameNode(frameNode, context),
|
|
123
|
+
frame = new Frame(context, string, node, assumptions);
|
|
122
124
|
|
|
123
125
|
return frame;
|
|
124
126
|
}
|
|
@@ -135,16 +137,16 @@ export function proofFromProofNode(proofNode, context) {
|
|
|
135
137
|
|
|
136
138
|
export function axiomFromAxiomNode(axiomNode, context) {
|
|
137
139
|
const { Axiom } = elements,
|
|
138
|
-
|
|
140
|
+
topLevelAsssertionNode = axiomNode, ///
|
|
139
141
|
proof = null,
|
|
140
|
-
labels =
|
|
141
|
-
deduction =
|
|
142
|
-
suppositions =
|
|
143
|
-
signature =
|
|
142
|
+
labels = labelsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
143
|
+
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
144
|
+
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
145
|
+
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
144
146
|
hypotheses = [],
|
|
145
|
-
|
|
147
|
+
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
146
148
|
node = axiomNode, ///
|
|
147
|
-
string =
|
|
149
|
+
string = topLevelAsssertionString, ///
|
|
148
150
|
axiom = new Axiom(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
149
151
|
|
|
150
152
|
return axiom;
|
|
@@ -157,7 +159,7 @@ export function sectionFromSectionNode(sectionNode, context) {
|
|
|
157
159
|
lemma = lemmaFromSectionNode(sectionNode, context),
|
|
158
160
|
theorem = theoremFromSectionNode(sectionNode, context),
|
|
159
161
|
conjecture = conjectureFromSectionNode(sectionNode, context),
|
|
160
|
-
sectionString =
|
|
162
|
+
sectionString = sectionStringFromHypothesesTopLevelAssertion(hypotheses, axiom, lemma, theorem, conjecture, context),
|
|
161
163
|
node = sectionNode, ///
|
|
162
164
|
string = sectionString, ///
|
|
163
165
|
section = new Section(context, string, node, hypotheses, axiom, lemma, theorem, conjecture);
|
|
@@ -178,16 +180,16 @@ export function premiseFromPremiseNode(premiseNode, context) {
|
|
|
178
180
|
|
|
179
181
|
export function theoremFromTheoremNode(theoremNode, context) {
|
|
180
182
|
const { Theorem } = elements,
|
|
181
|
-
|
|
182
|
-
proof =
|
|
183
|
-
labels =
|
|
184
|
-
deduction =
|
|
185
|
-
suppositions =
|
|
186
|
-
signature =
|
|
183
|
+
topLevelAsssertionNode = theoremNode, ///
|
|
184
|
+
proof = proofFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
185
|
+
labels = labelsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
186
|
+
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
187
|
+
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
188
|
+
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
187
189
|
hypotheses = [],
|
|
188
|
-
|
|
190
|
+
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
189
191
|
node = theoremNode, ///
|
|
190
|
-
string =
|
|
192
|
+
string = topLevelAsssertionString, ///
|
|
191
193
|
theorem = new Theorem(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
192
194
|
|
|
193
195
|
return theorem;
|
|
@@ -207,24 +209,20 @@ export function equalityFromEqualityNode(equalityNode, context) {
|
|
|
207
209
|
}
|
|
208
210
|
|
|
209
211
|
export function metaTypeFromMetaTypeNode(metaTypeNode, context) {
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
string = context.nodeAsString(node),
|
|
213
|
-
metaTypeName = metaTypeNode.getMetaTypeName(),
|
|
214
|
-
name = metaTypeName, ///
|
|
215
|
-
metaType = new MetaType(context, string, node, name);
|
|
212
|
+
const metaTypeName = metaTypeNode.getMetaTypeName(),
|
|
213
|
+
metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
216
214
|
|
|
217
215
|
return metaType;
|
|
218
216
|
}
|
|
219
217
|
|
|
220
218
|
export function propertyFromPropertyNode(propertyNode, context) {
|
|
221
219
|
const { Property } = elements,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
220
|
+
node = propertyNode, ///
|
|
221
|
+
string = context.nodeAsString(node),
|
|
222
|
+
propertyName = propertyNode.getPropertyName(),
|
|
223
|
+
nominalTypeName = null,
|
|
224
|
+
name = propertyName, ///
|
|
225
|
+
property = new Property(context, string, node, name, nominalTypeName);
|
|
228
226
|
|
|
229
227
|
return property;
|
|
230
228
|
}
|
|
@@ -326,13 +324,14 @@ export function judgementFromJudgementNode(judgementNode, context) {
|
|
|
326
324
|
export function metaLemmaFromMetaLemmaNode(metaLemmaNode, context) {
|
|
327
325
|
const { MetaLemma } = elements,
|
|
328
326
|
metaLemmaMetathoremNode = metaLemmaNode, ///
|
|
329
|
-
proof =
|
|
330
|
-
label =
|
|
331
|
-
deduction =
|
|
332
|
-
suppositions =
|
|
327
|
+
proof = proofFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
328
|
+
label = labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
329
|
+
deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
330
|
+
suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
331
|
+
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
|
|
333
332
|
substitutions = null,
|
|
334
333
|
node = metaLemmaNode, ///
|
|
335
|
-
string =
|
|
334
|
+
string = topLevelMetaAssertionString, ///
|
|
336
335
|
metaLemma = new MetaLemma(context, string, node, label, suppositions, deduction, proof, substitutions);
|
|
337
336
|
|
|
338
337
|
return metaLemma;
|
|
@@ -340,11 +339,11 @@ export function metaLemmaFromMetaLemmaNode(metaLemmaNode, context) {
|
|
|
340
339
|
|
|
341
340
|
export function parameterFromParameterNode(parameterNode, context) {
|
|
342
341
|
const { Parameter } = elements,
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
342
|
+
node = parameterNode, ///
|
|
343
|
+
string = context.nodeAsString(node),
|
|
344
|
+
parameterName = parameterNode.getParameterName(),
|
|
345
|
+
name = parameterName, ///
|
|
346
|
+
parameter = new Parameter(context, string, node, name);
|
|
348
347
|
|
|
349
348
|
return parameter;
|
|
350
349
|
}
|
|
@@ -361,16 +360,16 @@ export function hypothesisFromHypothesisNode(hypotheseNode, context) {
|
|
|
361
360
|
|
|
362
361
|
export function conjectureFromConjectureNode(conjectureNode, context) {
|
|
363
362
|
const { Conjecture } = elements,
|
|
364
|
-
|
|
365
|
-
proof =
|
|
366
|
-
labels =
|
|
367
|
-
deduction =
|
|
368
|
-
suppositions =
|
|
369
|
-
signature =
|
|
363
|
+
topLevelAsssertionNode = conjectureNode, ///
|
|
364
|
+
proof = proofFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
365
|
+
labels = labelsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
366
|
+
deduction = deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
367
|
+
suppositions = suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
368
|
+
signature = signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context),
|
|
370
369
|
hypotheses = [],
|
|
371
|
-
|
|
370
|
+
topLevelAsssertionString = topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
372
371
|
node = conjectureNode, ///
|
|
373
|
-
string =
|
|
372
|
+
string = topLevelAsssertionString, ///
|
|
374
373
|
conjecture = new Conjecture(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
375
374
|
|
|
376
375
|
return conjecture;
|
|
@@ -438,26 +437,15 @@ export function typePrefixFromTypePrefixNode(typePrefixNode, context) {
|
|
|
438
437
|
return typePrefix;
|
|
439
438
|
}
|
|
440
439
|
|
|
441
|
-
export function metatheoremFromMetaLemmaNode(metatheoremNode, context) {
|
|
442
|
-
const { Metatehorem } = elements,
|
|
443
|
-
metaLemmaMetathoremNode = metatheoremNode, ///
|
|
444
|
-
proof = proofFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, context),
|
|
445
|
-
label = labelFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, context),
|
|
446
|
-
deduction = deductionFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, context),
|
|
447
|
-
suppositions = suppositionsFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, context),
|
|
448
|
-
substitutions = null,
|
|
449
|
-
node = metaLemmaNode, ///
|
|
450
|
-
string = metaLemmaMetatheoremStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
|
|
451
|
-
metatheorem = new Metatehorem(context, string, node, label, suppositions, deduction, proof, substitutions);
|
|
452
|
-
|
|
453
|
-
return metatheorem;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
440
|
export function referenceFromMetavariableNode(metavariableNode, context) {
|
|
457
441
|
const metavariableString = context.nodeAsString(metavariableNode),
|
|
458
442
|
referenceString = metavariableString, ///
|
|
459
443
|
string = referenceString, ///
|
|
460
|
-
|
|
444
|
+
fragmentContext = FragmentContext.fromNothing(context);
|
|
445
|
+
|
|
446
|
+
context = fragmentContext; ///
|
|
447
|
+
|
|
448
|
+
const referenceNode = instantiateReference(string, context),
|
|
461
449
|
reference = referenceFromReferenceNode(referenceNode, context);
|
|
462
450
|
|
|
463
451
|
return reference;
|
|
@@ -473,6 +461,17 @@ export function hyppothesisFromHypothesisNode(hypothesisNode, context) {
|
|
|
473
461
|
return hypothesis
|
|
474
462
|
}
|
|
475
463
|
|
|
464
|
+
export function substitutionFromParameterNode(substitutionNode, context) {
|
|
465
|
+
const { Substitution } = elements,
|
|
466
|
+
node = substitutionNode, ///
|
|
467
|
+
string = context.nodeAsString(node),
|
|
468
|
+
substitutionName = substitutionNode.getSubstitutionName(),
|
|
469
|
+
name = substitutionName, ///
|
|
470
|
+
substitution = new Substitution(context, string, node, name);
|
|
471
|
+
|
|
472
|
+
return substitution;
|
|
473
|
+
}
|
|
474
|
+
|
|
476
475
|
export function constructorFromConstructorNode(constructorNode, context) {
|
|
477
476
|
const { Constructor } = elements,
|
|
478
477
|
node = constructorNode, ///
|
|
@@ -505,6 +504,22 @@ export function equivalenceFromEquivalenceNode(equivalenceNode, context) {
|
|
|
505
504
|
return equivalence;
|
|
506
505
|
}
|
|
507
506
|
|
|
507
|
+
export function metatheoremFromMetatheoremNode(metatheoremNode, context) {
|
|
508
|
+
const { Metatehorem } = elements,
|
|
509
|
+
metaLemmaMetathoremNode = metatheoremNode, ///
|
|
510
|
+
proof = proofFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
511
|
+
label = labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
512
|
+
deduction = deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
513
|
+
suppositions = suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
514
|
+
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
|
|
515
|
+
substitutions = null,
|
|
516
|
+
node = metaLemmaNode, ///
|
|
517
|
+
string = topLevelMetaAssertionString, ///
|
|
518
|
+
metatheorem = new Metatehorem(context, string, node, label, suppositions, deduction, proof, substitutions);
|
|
519
|
+
|
|
520
|
+
return metatheorem;
|
|
521
|
+
}
|
|
522
|
+
|
|
508
523
|
export function nameFromProcedureReferenceNode(procedureReferenceNode, context) {
|
|
509
524
|
const name = procedureReferenceNode.getName();
|
|
510
525
|
|
|
@@ -673,17 +688,26 @@ export function procedureReferenceFromProcedureReferenceNode(procedureReferenceN
|
|
|
673
688
|
node = procedureReferenceNode, ///
|
|
674
689
|
string = context.nodeAsString(node),
|
|
675
690
|
name = nameFromProcedureReferenceNode(procedureReferenceNode, context),
|
|
676
|
-
|
|
691
|
+
procedureDeclaration = new ProcedureReference(context, string, node, name);
|
|
677
692
|
|
|
678
|
-
return
|
|
693
|
+
return procedureDeclaration;
|
|
679
694
|
}
|
|
680
695
|
|
|
681
696
|
export function variableDeclarationFromVariableDeclarationNode(variableDeclarationNode, context) {
|
|
682
697
|
const { VariableDeclaration } = elements,
|
|
683
698
|
node = variableDeclarationNode, ///
|
|
684
699
|
string = context.nodeAsString(node),
|
|
685
|
-
|
|
686
|
-
|
|
700
|
+
typeNode = variableDeclarationNode.getTypeNode(),
|
|
701
|
+
provisional = variableDeclarationNode.isProvisional(),
|
|
702
|
+
variableNode = variableDeclarationNode.getVariableNode(),
|
|
703
|
+
type = typeFromTypeNode(typeNode, context),
|
|
704
|
+
variable = variableFromVariableNode(variableNode, context);
|
|
705
|
+
|
|
706
|
+
type.setProvisional(provisional);
|
|
707
|
+
|
|
708
|
+
variable.setType(type);
|
|
709
|
+
|
|
710
|
+
const variableDeclaration = new VariableDeclaration(context, string, node, variable);
|
|
687
711
|
|
|
688
712
|
return variableDeclaration;
|
|
689
713
|
}
|
|
@@ -724,8 +748,8 @@ export function statementSubstitutionFromStatementSubstitutionNode(statementSubs
|
|
|
724
748
|
node = statementSubstitutionNode, ///
|
|
725
749
|
string = context.nodeAsString(node),
|
|
726
750
|
resolved = true,
|
|
727
|
-
statement =
|
|
728
|
-
metavariable =
|
|
751
|
+
statement = statementFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
752
|
+
metavariable = metavariableFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
729
753
|
substitution = null,
|
|
730
754
|
statementSubstitution = new StatementSubstitution(context, string, node, resolved, statement, metavariable, substitution);
|
|
731
755
|
|
|
@@ -1297,6 +1321,18 @@ export function frameFromFrameSubstitutionNode(frameSubstitutionNode, context) {
|
|
|
1297
1321
|
return frame;
|
|
1298
1322
|
}
|
|
1299
1323
|
|
|
1324
|
+
export function proofFromTopLevelAssertionNode(topLevelAsssertionNode, context) {
|
|
1325
|
+
let proof = null;
|
|
1326
|
+
|
|
1327
|
+
const proofNode = topLevelAsssertionNode.getProofNode();
|
|
1328
|
+
|
|
1329
|
+
if (proofNode !== null) {
|
|
1330
|
+
proof = proofFromProofNode(proofNode, context);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
return proof;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1300
1336
|
export function subproofFromStepOrSubproofNode(subproofOrSubproofNode, context) {
|
|
1301
1337
|
let subproof = null;
|
|
1302
1338
|
|
|
@@ -1407,7 +1443,43 @@ export function termSubstitutionFromStatementNode(statementNode, context) {
|
|
|
1407
1443
|
return termSubstitution;
|
|
1408
1444
|
}
|
|
1409
1445
|
|
|
1410
|
-
export function
|
|
1446
|
+
export function typeFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
1447
|
+
let type = null;
|
|
1448
|
+
|
|
1449
|
+
const typeNode = simpleTypeDeclarationNode.getTypeNode();
|
|
1450
|
+
|
|
1451
|
+
if (typeNode !== null) {
|
|
1452
|
+
type = typeFromTypeNode(typeNode, context);
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
return type;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
export function deductionFromTopLevelAssertionNode(topLevelAsssertionNode, context) {
|
|
1459
|
+
let deduction = null;
|
|
1460
|
+
|
|
1461
|
+
const deductionNode = topLevelAsssertionNode.getDeductionNode();
|
|
1462
|
+
|
|
1463
|
+
if (deductionNode !== null) {
|
|
1464
|
+
deduction = deductionFromDeductionNode(deductionNode, context);
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
return deduction;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
export function signatureFromTopLevelAssertionNode(topLevelAsssertionNode, context) {
|
|
1471
|
+
let signature = null;
|
|
1472
|
+
|
|
1473
|
+
const signatureNode = topLevelAsssertionNode.getSignatureNode();
|
|
1474
|
+
|
|
1475
|
+
if (signatureNode !== null) {
|
|
1476
|
+
signature = signatureFromSignatureNode(signatureNode, context);
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
return signature;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
export function proofFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1411
1483
|
let proof = null;
|
|
1412
1484
|
|
|
1413
1485
|
const proofNode = metaLemmaMetathoremNode.getProofNode();
|
|
@@ -1419,7 +1491,7 @@ export function proofFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, conte
|
|
|
1419
1491
|
return proof;
|
|
1420
1492
|
}
|
|
1421
1493
|
|
|
1422
|
-
export function
|
|
1494
|
+
export function labelFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1423
1495
|
let label = null;
|
|
1424
1496
|
|
|
1425
1497
|
const labelNode = metaLemmaMetathoremNode.getLabelNode();
|
|
@@ -1431,18 +1503,6 @@ export function labelFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, conte
|
|
|
1431
1503
|
return label;
|
|
1432
1504
|
}
|
|
1433
1505
|
|
|
1434
|
-
export function typeFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context) {
|
|
1435
|
-
let type = null;
|
|
1436
|
-
|
|
1437
|
-
const typeNode = simpleTypeDeclarationNode.getTypeNode();
|
|
1438
|
-
|
|
1439
|
-
if (typeNode !== null) {
|
|
1440
|
-
type = typeFromTypeNode(typeNode, context);
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
return type;
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
1506
|
export function frameSubstitutionFromStatementNode(statementNode, context) {
|
|
1447
1507
|
let frameSubstitution = null;
|
|
1448
1508
|
|
|
@@ -1637,7 +1697,7 @@ export function metavariableFromFrameSubstitutionNode(frameSubstitutionNode, con
|
|
|
1637
1697
|
return metavariable;
|
|
1638
1698
|
}
|
|
1639
1699
|
|
|
1640
|
-
export function
|
|
1700
|
+
export function deductionFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
1641
1701
|
let deduction = null;
|
|
1642
1702
|
|
|
1643
1703
|
const deductionNode = metaLemmaMetathoremNode.getDeductionNode();
|
|
@@ -1733,18 +1793,6 @@ export function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationN
|
|
|
1733
1793
|
return metaType;
|
|
1734
1794
|
}
|
|
1735
1795
|
|
|
1736
|
-
export function proofFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
|
|
1737
|
-
let proof = null;
|
|
1738
|
-
|
|
1739
|
-
const proofNode = axiomLemmaTheoremConjectureNode.getProofNode();
|
|
1740
|
-
|
|
1741
|
-
if (proofNode !== null) {
|
|
1742
|
-
proof = proofFromProofNode(proofNode, context);
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
return proof;
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
1796
|
export function propertyRelationFromPropertyAssertionNode(propertyAssertionNode, context) {
|
|
1749
1797
|
let propertyRelation = null;
|
|
1750
1798
|
|
|
@@ -1805,30 +1853,6 @@ export function metavariableFromMetavariableDeclarationNode(metavariableDeclarat
|
|
|
1805
1853
|
return metavariable;
|
|
1806
1854
|
}
|
|
1807
1855
|
|
|
1808
|
-
export function deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
|
|
1809
|
-
let deduction = null;
|
|
1810
|
-
|
|
1811
|
-
const deductionNode = axiomLemmaTheoremConjectureNode.getDeductionNode();
|
|
1812
|
-
|
|
1813
|
-
if (deductionNode !== null) {
|
|
1814
|
-
deduction = deductionFromDeductionNode(deductionNode, context);
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
return deduction;
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
export function signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
|
|
1821
|
-
let signature = null;
|
|
1822
|
-
|
|
1823
|
-
const signatureNode = axiomLemmaTheoremConjectureNode.getSignatureNode();
|
|
1824
|
-
|
|
1825
|
-
if (signatureNode !== null) {
|
|
1826
|
-
signature = signatureFromSignatureNode(signatureNode, context);
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
return signature;
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
1856
|
export function termsFromTermNodes(termNodes, context) {
|
|
1833
1857
|
const terms = termNodes.map((termNode) => {
|
|
1834
1858
|
const term = termFromTermNode(termNode, context);
|
|
@@ -1988,6 +2012,13 @@ export function parametersFromProcedureCallNode(procedureCallNode, context) {
|
|
|
1988
2012
|
return parameters;
|
|
1989
2013
|
}
|
|
1990
2014
|
|
|
2015
|
+
export function labelsFromTopLevelAssertionNode(topLevelAsssertionNode, context) {
|
|
2016
|
+
const labelNodes = topLevelAsssertionNode.getLabelNodes(),
|
|
2017
|
+
labels = labelsFromLabelNodes(labelNodes, context);
|
|
2018
|
+
|
|
2019
|
+
return labels;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
1991
2022
|
export function statementsFromSubproofAssertionNode(subproofAssertionNode, context) {
|
|
1992
2023
|
const statementNodes = subproofAssertionNode.getStatementNodes(),
|
|
1993
2024
|
statements = statementsFromStatementNodes(statementNodes, context);
|
|
@@ -1995,8 +2026,8 @@ export function statementsFromSubproofAssertionNode(subproofAssertionNode, conte
|
|
|
1995
2026
|
return statements;
|
|
1996
2027
|
}
|
|
1997
2028
|
|
|
1998
|
-
export function
|
|
1999
|
-
const suppositionNodes =
|
|
2029
|
+
export function suppositionsFromTopLevelAssertionNode(topLevelAsssertionNode, context) {
|
|
2030
|
+
const suppositionNodes = topLevelAsssertionNode.getSuppositionNodes(),
|
|
2000
2031
|
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
|
|
2001
2032
|
|
|
2002
2033
|
return suppositions;
|
|
@@ -2016,33 +2047,9 @@ export function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationN
|
|
|
2016
2047
|
return superTypes;
|
|
2017
2048
|
}
|
|
2018
2049
|
|
|
2019
|
-
export function
|
|
2020
|
-
const
|
|
2021
|
-
labels = labelsFromLabelNodes(labelNodes, context);
|
|
2022
|
-
|
|
2023
|
-
return labels;
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
export function suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
|
|
2027
|
-
const suppositionNodes = axiomLemmaTheoremConjectureNode.getSuppositionNodes(),
|
|
2050
|
+
export function suppositionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
2051
|
+
const suppositionNodes = metaLemmaMetathoremNode.getSuppositionNodes(),
|
|
2028
2052
|
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
|
|
2029
2053
|
|
|
2030
2054
|
return suppositions;
|
|
2031
2055
|
}
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
export function _typeFromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
|
|
2037
|
-
let type = null;
|
|
2038
|
-
|
|
2039
|
-
const typeNode = metavariableDeclarationNode.getTypeNode();
|
|
2040
|
-
|
|
2041
|
-
if (typeNode !== null) {
|
|
2042
|
-
const nominalTypeName = typeNode.getNominalTypeName();
|
|
2043
|
-
|
|
2044
|
-
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
2045
|
-
}
|
|
2046
|
-
|
|
2047
|
-
return type;
|
|
2048
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import FragmentContext from "../context/fragment";
|
|
4
|
+
|
|
5
|
+
export function withinFragment(innerFunction, context) {
|
|
6
|
+
const fragmentContext = FragmentContext.fromNothing(context);
|
|
7
|
+
|
|
8
|
+
context = fragmentContext; ///
|
|
9
|
+
|
|
10
|
+
return innerFunction(context);
|
|
11
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import nominalContext from "../context/nominal";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { withinFragment } from "../utilities/fragment";
|
|
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 = withinFragment((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 = withinFragment((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;
|