occam-verify-cli 1.0.438 → 1.0.444
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/context/file.js +38 -35
- package/lib/context/local.js +10 -10
- package/lib/context/release.js +6 -6
- package/lib/context/temporary.js +14 -14
- package/lib/element/assertion/contained.js +45 -45
- package/lib/element/assertion/defined.js +13 -13
- package/lib/element/assertion/property.js +23 -22
- package/lib/element/assertion/satisfies.js +7 -6
- package/lib/element/assertion/subproof.js +20 -17
- package/lib/element/assertion/type.js +3 -2
- package/lib/element/assertion.js +1 -23
- package/lib/element/assumption.js +24 -22
- package/lib/element/axiom.js +9 -12
- package/lib/element/axiomLemmaTheoremConjecture.js +32 -32
- package/lib/element/{statement/combinator → combinator}/bracketed.js +16 -16
- package/lib/element/combinator.js +229 -0
- package/lib/element/conclusion.js +11 -9
- package/lib/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/lib/element/constructor.js +232 -0
- package/lib/element/declaration/combinator.js +2 -16
- package/lib/element/declaration/complexType.js +12 -12
- package/lib/element/declaration/constructor.js +13 -11
- package/lib/element/declaration/simpleType.js +4 -4
- package/lib/element/declaration/typePrefix.js +2 -2
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +11 -9
- package/lib/element/derivation.js +7 -10
- package/lib/element/equivalence.js +10 -10
- package/lib/element/equivalences.js +5 -5
- package/lib/element/frame.js +32 -38
- package/lib/element/hypothesis.js +3 -3
- package/lib/element/judgement.js +6 -4
- package/lib/element/label.js +8 -8
- package/lib/element/metaLemmaMetatheorem.js +5 -5
- package/lib/element/metaType.js +17 -80
- package/lib/element/metavariable.js +34 -34
- package/lib/element/parameter.js +3 -3
- package/lib/element/premise.js +49 -58
- package/lib/element/property.js +9 -9
- package/lib/element/propertyRelation.js +13 -13
- package/lib/element/reference.js +14 -17
- package/lib/element/rule.js +21 -21
- package/lib/element/signature.js +11 -11
- package/lib/element/statement.js +18 -18
- package/lib/element/step.js +83 -55
- package/lib/element/subDerivation.js +7 -10
- package/lib/element/subproof.js +6 -14
- package/lib/element/substitution/frame.js +1 -7
- package/lib/element/substitution/reference.js +2 -3
- package/lib/element/substitution/statement.js +44 -15
- package/lib/element/substitution/term.js +10 -57
- package/lib/element/substitution.js +5 -11
- package/lib/element/substitutions.js +29 -29
- package/lib/element/supposition.js +63 -55
- package/lib/element/term.js +21 -34
- package/lib/element/type.js +47 -60
- package/lib/element/typePrefix.js +5 -5
- package/lib/element/variable.js +9 -9
- package/lib/element.js +9 -3
- package/lib/metaTypes.js +52 -0
- package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
- package/lib/node/body/axiom.js +2 -25
- package/lib/node/body/conjecture.js +2 -25
- package/lib/node/body/lemma.js +2 -25
- package/lib/node/body/metaLemma.js +2 -25
- package/lib/node/body/metatheorem.js +2 -25
- package/lib/node/body/rule.js +15 -1
- package/lib/node/body/theorem.js +2 -25
- package/lib/node/body.js +25 -2
- package/lib/node/combinator.js +11 -2
- package/lib/node/constructor.js +11 -2
- package/lib/node/declaration/combinator.js +5 -5
- package/lib/node/declaration/constructor.js +8 -8
- package/lib/node/declaration/property.js +15 -15
- package/lib/node/declaration/simpleType.js +31 -31
- package/lib/node/declaration/variable.js +8 -8
- package/lib/node/equality.js +8 -8
- package/lib/node/frame.js +20 -20
- package/lib/node/header.js +22 -22
- package/lib/node/metaLemmaMetaTheorem.js +16 -16
- package/lib/node/metavariable.js +15 -15
- package/lib/node/property.js +8 -8
- package/lib/node/propertyRelation.js +8 -8
- package/lib/node/rule.js +16 -16
- package/lib/node/statement.js +12 -12
- package/lib/node/step.js +22 -22
- package/lib/node/subproof.js +8 -8
- package/lib/node/substitution/frame.js +19 -19
- package/lib/node/substitution/statement.js +19 -19
- package/lib/node/substitution/term.js +19 -19
- package/lib/node/term.js +35 -35
- package/lib/preamble.js +5 -5
- package/lib/process/instantiate.js +20 -2
- package/lib/process/unify.js +39 -42
- package/lib/process/validate.js +431 -0
- package/lib/process/verify.js +44 -135
- package/lib/types.js +27 -0
- package/lib/utilities/brackets.js +4 -4
- package/lib/utilities/element.js +91 -55
- package/lib/utilities/instance.js +18 -18
- package/lib/utilities/statement.js +2 -2
- package/lib/utilities/string.js +21 -10
- package/lib/utilities/unification.js +237 -0
- package/lib/utilities/validation.js +251 -0
- package/package.json +6 -6
- package/src/context/file.js +37 -31
- package/src/context/local.js +8 -8
- package/src/context/release.js +9 -6
- package/src/context/temporary.js +11 -11
- package/src/element/assertion/contained.js +19 -20
- package/src/element/assertion/defined.js +11 -12
- package/src/element/assertion/property.js +20 -20
- package/src/element/assertion/satisfies.js +6 -6
- package/src/element/assertion/subproof.js +17 -15
- package/src/element/assertion/type.js +2 -2
- package/src/element/assertion.js +0 -2
- package/src/element/assumption.js +22 -19
- package/src/element/axiom.js +7 -11
- package/src/element/axiomLemmaTheoremConjecture.js +36 -36
- package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
- package/src/element/combinator.js +90 -0
- package/src/element/conclusion.js +12 -10
- package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/src/element/{term/constructor.js → constructor.js} +17 -25
- package/src/element/declaration/combinator.js +1 -22
- package/src/element/declaration/complexType.js +11 -11
- package/src/element/declaration/constructor.js +13 -10
- package/src/element/declaration/simpleType.js +3 -3
- package/src/element/declaration/typePrefix.js +1 -1
- package/src/element/declaration/variable.js +2 -2
- package/src/element/deduction.js +12 -9
- package/src/element/derivation.js +6 -10
- package/src/element/equivalence.js +8 -8
- package/src/element/equivalences.js +4 -4
- package/src/element/frame.js +28 -30
- package/src/element/hypothesis.js +2 -2
- package/src/element/judgement.js +6 -3
- package/src/element/label.js +4 -4
- package/src/element/metaLemmaMetatheorem.js +4 -3
- package/src/element/metaType.js +9 -45
- package/src/element/metavariable.js +29 -31
- package/src/element/parameter.js +2 -2
- package/src/element/premise.js +55 -62
- package/src/element/property.js +6 -6
- package/src/element/propertyRelation.js +11 -11
- package/src/element/reference.js +12 -21
- package/src/element/rule.js +17 -16
- package/src/element/signature.js +10 -9
- package/src/element/statement.js +16 -18
- package/src/element/step.js +93 -55
- package/src/element/subDerivation.js +6 -10
- package/src/element/subproof.js +4 -12
- package/src/element/substitution/frame.js +0 -2
- package/src/element/substitution/reference.js +1 -5
- package/src/element/substitution/statement.js +44 -14
- package/src/element/substitution/term.js +10 -13
- package/src/element/substitution.js +3 -5
- package/src/element/substitutions.js +48 -30
- package/src/element/supposition.js +88 -70
- package/src/element/term.js +18 -28
- package/src/element/type.js +42 -36
- package/src/element/typePrefix.js +3 -3
- package/src/element/variable.js +7 -7
- package/src/element.js +3 -1
- package/src/metaTypes.js +42 -0
- package/src/node/axiomLemmaTheoremConjecture.js +6 -6
- package/src/node/body/axiom.js +0 -21
- package/src/node/body/conjecture.js +0 -23
- package/src/node/body/lemma.js +0 -23
- package/src/node/body/metaLemma.js +0 -23
- package/src/node/body/metatheorem.js +0 -23
- package/src/node/body/rule.js +12 -0
- package/src/node/body/theorem.js +0 -23
- package/src/node/body.js +23 -0
- package/src/node/combinator.js +9 -0
- package/src/node/constructor.js +9 -0
- package/src/node/declaration/combinator.js +5 -5
- package/src/node/declaration/constructor.js +8 -8
- package/src/node/declaration/property.js +14 -14
- package/src/node/declaration/simpleType.js +31 -31
- package/src/node/declaration/variable.js +7 -7
- package/src/node/equality.js +7 -7
- package/src/node/frame.js +21 -21
- package/src/node/header.js +22 -22
- package/src/node/metaLemmaMetaTheorem.js +14 -14
- package/src/node/metavariable.js +14 -14
- package/src/node/property.js +7 -7
- package/src/node/propertyRelation.js +7 -7
- package/src/node/rule.js +15 -15
- package/src/node/statement.js +12 -12
- package/src/node/step.js +21 -21
- package/src/node/subproof.js +7 -7
- package/src/node/substitution/frame.js +18 -18
- package/src/node/substitution/statement.js +18 -18
- package/src/node/substitution/term.js +18 -18
- package/src/node/term.js +34 -34
- package/src/preamble.js +4 -4
- package/src/process/instantiate.js +12 -0
- package/src/process/unify.js +53 -57
- package/src/process/validate.js +316 -0
- package/src/process/verify.js +50 -138
- package/src/types.js +18 -0
- package/src/utilities/brackets.js +10 -6
- package/src/utilities/element.js +125 -82
- package/src/utilities/instance.js +18 -18
- package/src/utilities/statement.js +2 -2
- package/src/utilities/string.js +34 -20
- package/src/{mixins/step/unify.js → utilities/unification.js} +82 -68
- package/src/{mixins/statement/validate.js → utilities/validation.js} +143 -69
- package/lib/element/statement/combinator.js +0 -105
- package/lib/element/term/constructor.js +0 -172
- package/lib/mixins/statement/validate.js +0 -198
- package/lib/mixins/step/unify.js +0 -228
- package/lib/mixins/term/verify.js +0 -65
- package/src/element/statement/combinator.js +0 -59
- package/src/mixins/term/verify.js +0 -81
package/src/utilities/element.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import elements from "../elements";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { baseTypeFromNothing } from "../types";
|
|
6
6
|
import { instantiateReference } from "../process/instantiate";
|
|
7
7
|
import { equivalenceStringFromTerms,
|
|
8
|
-
subproofStringFromSubproofNode,
|
|
9
8
|
rulsStringFromLabelsPremisesAndConclusion,
|
|
9
|
+
subproofStringFromSuppositionsAndSubDerivation,
|
|
10
10
|
procedureCallStringFromProcedureReferenceAndParameters,
|
|
11
11
|
sectionStringFromHypothesesAxiomLemmaTheoremAndConjecture,
|
|
12
12
|
metaLemmaMetatheoremStringFromLabelSuppositionsAndDeduction,
|
|
@@ -16,7 +16,9 @@ export function typeFromTypeNode(typeNode, context) {
|
|
|
16
16
|
let type;
|
|
17
17
|
|
|
18
18
|
if (typeNode === null) {
|
|
19
|
-
|
|
19
|
+
const baseType = baseTypeFromNothing();
|
|
20
|
+
|
|
21
|
+
type = baseType; ///
|
|
20
22
|
} else {
|
|
21
23
|
const { Type } = elements,
|
|
22
24
|
typeName = typeNode.getTypeName(),
|
|
@@ -240,13 +242,13 @@ export function variableFromVariableNode(variableNode, context) {
|
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
export function subproofFromSubproofNode(subproofNode, context) {
|
|
243
|
-
const {
|
|
245
|
+
const { Subproof } = elements,
|
|
244
246
|
node = subproofNode, ///
|
|
245
247
|
suppositions = suppositionsFromSubproofNode(subproofNode, context),
|
|
246
248
|
subDerivation = subDerivationFromSubproofNode(subproofNode, context),
|
|
247
|
-
subproofString =
|
|
249
|
+
subproofString = subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation, context),
|
|
248
250
|
string = subproofString, ///
|
|
249
|
-
subproof = new
|
|
251
|
+
subproof = new Subproof(context, string, node, suppositions, subDerivation);
|
|
250
252
|
|
|
251
253
|
return subproof;
|
|
252
254
|
}
|
|
@@ -310,23 +312,6 @@ export function referenceFromReferenceNode(referenceNode, context) {
|
|
|
310
312
|
return reference;
|
|
311
313
|
}
|
|
312
314
|
|
|
313
|
-
export function conjectureroConjectureNode(conjectureNode, context) {
|
|
314
|
-
const { Conjecture } = elements,
|
|
315
|
-
axiomLemmaTheoremConjectureNode = conjectureNode, ///
|
|
316
|
-
proof = proofFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
317
|
-
labels = labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
318
|
-
deduction = deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
319
|
-
suppositions = suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
320
|
-
signature = signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
321
|
-
hypotheses = [],
|
|
322
|
-
axiomLemmaTheoremConjectureString = axiomLemmaTheoremConjectureStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
323
|
-
node = conjectureNode, ///
|
|
324
|
-
string = axiomLemmaTheoremConjectureString, ///
|
|
325
|
-
conjecture = new Conjecture(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
326
|
-
|
|
327
|
-
return conjecture;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
315
|
export function judgementFromJudgementNode(judgementNode, context) {
|
|
331
316
|
const { Judgement } = elements,
|
|
332
317
|
node = judgementNode, ///
|
|
@@ -374,6 +359,33 @@ export function hypothesisFromHypothesisNode(hypotheseNode, context) {
|
|
|
374
359
|
return parameter;
|
|
375
360
|
}
|
|
376
361
|
|
|
362
|
+
export function conjectureFromConjectureNode(conjectureNode, context) {
|
|
363
|
+
const { Conjecture } = elements,
|
|
364
|
+
axiomLemmaTheoremConjectureNode = conjectureNode, ///
|
|
365
|
+
proof = proofFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
366
|
+
labels = labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
367
|
+
deduction = deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
368
|
+
suppositions = suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
369
|
+
signature = signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
370
|
+
hypotheses = [],
|
|
371
|
+
axiomLemmaTheoremConjectureString = axiomLemmaTheoremConjectureStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
372
|
+
node = conjectureNode, ///
|
|
373
|
+
string = axiomLemmaTheoremConjectureString, ///
|
|
374
|
+
conjecture = new Conjecture(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
375
|
+
|
|
376
|
+
return conjecture;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export function combinatorFromCombinatorNode(combinatorNode, context) {
|
|
380
|
+
const { Combinator } = elements,
|
|
381
|
+
node = combinatorNode, ///
|
|
382
|
+
string = context.nodeAsString(node),
|
|
383
|
+
statement = statementFromCombinatorNode(combinatorNode, context),
|
|
384
|
+
combinator = new Combinator(context, string, node, statement);
|
|
385
|
+
|
|
386
|
+
return combinator;
|
|
387
|
+
}
|
|
388
|
+
|
|
377
389
|
export function conclusionFromConclusionNode(conclusionNode, context) {
|
|
378
390
|
const { Conclusion } = elements,
|
|
379
391
|
node = conclusionNode, ///
|
|
@@ -461,6 +473,16 @@ export function hyppothesisFromHypothesisNode(hypothesisNode, context) {
|
|
|
461
473
|
return hypothesis
|
|
462
474
|
}
|
|
463
475
|
|
|
476
|
+
export function constructorFromConstructorNode(constructorNode, context) {
|
|
477
|
+
const { Constructor } = elements,
|
|
478
|
+
node = constructorNode, ///
|
|
479
|
+
string = context.nodeAsString(node),
|
|
480
|
+
term = termFromConstructorNode(constructorNode, context),
|
|
481
|
+
constructor = new Constructor(context, string, node, term);
|
|
482
|
+
|
|
483
|
+
return constructor;
|
|
484
|
+
}
|
|
485
|
+
|
|
464
486
|
export function suppositionFromSuppositionNode(suppositionNode, context) {
|
|
465
487
|
const { Supposition } = elements,
|
|
466
488
|
node = suppositionNode, ///
|
|
@@ -702,8 +724,8 @@ export function statementSubstitutionFromStatementSubstitutionNode(statementSubs
|
|
|
702
724
|
node = statementSubstitutionNode, ///
|
|
703
725
|
string = context.nodeAsString(node),
|
|
704
726
|
resolved = true,
|
|
705
|
-
statement =
|
|
706
|
-
metavariable =
|
|
727
|
+
statement = null,
|
|
728
|
+
metavariable = null,
|
|
707
729
|
substitution = null,
|
|
708
730
|
statementSubstitution = new StatementSubstitution(context, string, node, resolved, statement, metavariable, substitution);
|
|
709
731
|
|
|
@@ -876,6 +898,18 @@ export function derivationFromProofNode(proofNode, context) {
|
|
|
876
898
|
return derivation;
|
|
877
899
|
}
|
|
878
900
|
|
|
901
|
+
export function termFromConstructorNode(ocnstructorNode, context) {
|
|
902
|
+
let term = null;
|
|
903
|
+
|
|
904
|
+
const termNode = ocnstructorNode.getTermNode();
|
|
905
|
+
|
|
906
|
+
if (termNode !== null) {
|
|
907
|
+
term = termFromTermNode(termNode, context);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
return term;
|
|
911
|
+
}
|
|
912
|
+
|
|
879
913
|
export function statementFromPremiseNode(premiseNode, context) {
|
|
880
914
|
let statement = null;
|
|
881
915
|
|
|
@@ -924,18 +958,6 @@ export function conclusionFromPremiseNode(premiseNode, context) {
|
|
|
924
958
|
return conclusion;
|
|
925
959
|
}
|
|
926
960
|
|
|
927
|
-
export function judgementFomStatementNode(statementNode, context) {
|
|
928
|
-
let judgement = null;
|
|
929
|
-
|
|
930
|
-
const judgementNode = statementNode.getJudgementNode();
|
|
931
|
-
|
|
932
|
-
if (judgementNode !== null) {
|
|
933
|
-
judgement = judgementFromJudgementNode(judgementNode, context);
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
return judgement;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
961
|
export function termFromTypeAssertionNode(typeAssertionNode, context) {
|
|
940
962
|
let term = null;
|
|
941
963
|
|
|
@@ -991,6 +1013,18 @@ export function statementFromDeductionNode(deductionNode, context) {
|
|
|
991
1013
|
return statement;
|
|
992
1014
|
}
|
|
993
1015
|
|
|
1016
|
+
export function judgementFromStatementNode(statementNode, context) {
|
|
1017
|
+
let judgement = null;
|
|
1018
|
+
|
|
1019
|
+
const judgementNode = statementNode.getJudgementNode();
|
|
1020
|
+
|
|
1021
|
+
if (judgementNode !== null) {
|
|
1022
|
+
judgement = judgementFromJudgementNode(judgementNode, context);
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
return judgement;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
994
1028
|
export function stepFromStepOrSubproofNode(stepOrSubproofNode, context) {
|
|
995
1029
|
let step = null;
|
|
996
1030
|
|
|
@@ -1005,6 +1039,18 @@ export function stepFromStepOrSubproofNode(stepOrSubproofNode, context) {
|
|
|
1005
1039
|
return step;
|
|
1006
1040
|
}
|
|
1007
1041
|
|
|
1042
|
+
export function statementFromCombinatorNode(combinatorNode, context) {
|
|
1043
|
+
let statement = null;
|
|
1044
|
+
|
|
1045
|
+
const statementNode = combinatorNode.getStatementNode();
|
|
1046
|
+
|
|
1047
|
+
if (statementNode !== null) {
|
|
1048
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
return statement;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1008
1054
|
export function statementFromConclusionNode(conclusinoNode, context) {
|
|
1009
1055
|
let statement = null;
|
|
1010
1056
|
|
|
@@ -1149,18 +1195,6 @@ export function subDerivationFromSubproofNode(subproofNode, context) {
|
|
|
1149
1195
|
return subDerviation;
|
|
1150
1196
|
}
|
|
1151
1197
|
|
|
1152
|
-
export function typeAssertinFromStatementNode(statementNode, context) {
|
|
1153
|
-
let typeAssertion = null;
|
|
1154
|
-
|
|
1155
|
-
const typeAssertionNode = statementNode.getTypeAssertionNode();
|
|
1156
|
-
|
|
1157
|
-
if (typeAssertionNode !== null) {
|
|
1158
|
-
typeAssertion = typeAssertionFromTypeAssertionNode(typeAssertionNode, context);
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
return typeAssertion;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
1198
|
export function metavariableFromReferenceNode(referenceNode, context) {
|
|
1165
1199
|
let metavariable = null;
|
|
1166
1200
|
|
|
@@ -1215,6 +1249,18 @@ export function parameterNameFromParameterNode(parameterNode, context) {
|
|
|
1215
1249
|
return parameterName;
|
|
1216
1250
|
}
|
|
1217
1251
|
|
|
1252
|
+
export function typeAssertionFromStatementNode(statementNode, context) {
|
|
1253
|
+
let typeAssertion = null;
|
|
1254
|
+
|
|
1255
|
+
const typeAssertionNode = statementNode.getTypeAssertionNode();
|
|
1256
|
+
|
|
1257
|
+
if (typeAssertionNode !== null) {
|
|
1258
|
+
typeAssertion = typeAssertionFromTypeAssertionNode(typeAssertionNode, context);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
return typeAssertion;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1218
1264
|
export function metavariableFromAssumptionNode(assumptionNode, context) {
|
|
1219
1265
|
let metavariable = null;
|
|
1220
1266
|
|
|
@@ -1301,6 +1347,18 @@ export function frameFromContainedAssertionNode(containedAssertionNode, context)
|
|
|
1301
1347
|
return frame;
|
|
1302
1348
|
}
|
|
1303
1349
|
|
|
1350
|
+
export function procedureCallFromSuppositionNode(suppositionNode, context) {
|
|
1351
|
+
let procedureCall = null;
|
|
1352
|
+
|
|
1353
|
+
const procedureCallNode = suppositionNode.getProcedureCallNode();
|
|
1354
|
+
|
|
1355
|
+
if (procedureCallNode !== null) {
|
|
1356
|
+
procedureCall = procedureCallFromProcedureCallNode(procedureCallNode, context);
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
return procedureCall;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1304
1362
|
export function propertyFromPropertyRelationNode(propertyRelationNode, context) {
|
|
1305
1363
|
let property = null;
|
|
1306
1364
|
|
|
@@ -1325,18 +1383,6 @@ export function variableFromTermSubstitutionNode(termSubstitutionNode, context)
|
|
|
1325
1383
|
return variable;
|
|
1326
1384
|
}
|
|
1327
1385
|
|
|
1328
|
-
export function procedureCallFromSuppositionNode(suppositionNode, context) {
|
|
1329
|
-
let procedureCall = null;
|
|
1330
|
-
|
|
1331
|
-
const procedureCallNode = suppositionNode.getProcedureCallNode();
|
|
1332
|
-
|
|
1333
|
-
if (procedureCallNode !== null) {
|
|
1334
|
-
procedureCall = procedureCallFromProcedureCallNode(procedureCallNode, context);
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
return procedureCall;
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
1386
|
export function definedAssertionFromStatementNode(statementNode, context) {
|
|
1341
1387
|
let definedAssertion = null;
|
|
1342
1388
|
|
|
@@ -1476,7 +1522,9 @@ export function typeFromConstructorDeclarationNode(constructorDeclarationNode, c
|
|
|
1476
1522
|
if (typeNode !== null) {
|
|
1477
1523
|
type = typeFromTypeNode(typeNode, context);
|
|
1478
1524
|
} else {
|
|
1479
|
-
|
|
1525
|
+
const baseType = baseTypeFromNothing();
|
|
1526
|
+
|
|
1527
|
+
type = baseType; ///
|
|
1480
1528
|
}
|
|
1481
1529
|
|
|
1482
1530
|
return type;
|
|
@@ -1664,13 +1712,10 @@ export function typePrefixFromTypePrefixDeclarationNode(typePrefixDeclarationNod
|
|
|
1664
1712
|
export function combinatorFromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
|
|
1665
1713
|
let combinator = null;
|
|
1666
1714
|
|
|
1667
|
-
const
|
|
1715
|
+
const combinatorNode = combinatorDeclarationNode.getCombinatorNode();
|
|
1668
1716
|
|
|
1669
|
-
if (
|
|
1670
|
-
|
|
1671
|
-
statement = statementFromStatementNode(statementNode, context);
|
|
1672
|
-
|
|
1673
|
-
combinator = new Combinator(statement);
|
|
1717
|
+
if (combinatorNode !== null) {
|
|
1718
|
+
combinator = combinatorFromCombinatorNode(combinatorNode, context);
|
|
1674
1719
|
}
|
|
1675
1720
|
|
|
1676
1721
|
return combinator;
|
|
@@ -1715,13 +1760,10 @@ export function propertyRelationFromPropertyAssertionNode(propertyAssertionNode,
|
|
|
1715
1760
|
export function constructorFromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
1716
1761
|
let constructor = null;
|
|
1717
1762
|
|
|
1718
|
-
const
|
|
1763
|
+
const constructorNode = constructorDeclarationNode.getConstructorNode();
|
|
1719
1764
|
|
|
1720
|
-
if (
|
|
1721
|
-
|
|
1722
|
-
term = termFromTermNode(termNode, context);
|
|
1723
|
-
|
|
1724
|
-
constructor = new Constructor(term);
|
|
1765
|
+
if (constructorNode !== null) {
|
|
1766
|
+
constructor = constructorFromConstructorNode(constructorNode, context);
|
|
1725
1767
|
}
|
|
1726
1768
|
|
|
1727
1769
|
return constructor;
|
|
@@ -1838,7 +1880,8 @@ export function superTypesFromSuperTypeNodes(superTypeNodes, context) {
|
|
|
1838
1880
|
superTypesLength = superTypes.length;
|
|
1839
1881
|
|
|
1840
1882
|
if (superTypesLength === 0) {
|
|
1841
|
-
const
|
|
1883
|
+
const baseType = baseTypeFromNothing(),
|
|
1884
|
+
superType = baseType; ///
|
|
1842
1885
|
|
|
1843
1886
|
superTypes.push(superType);
|
|
1844
1887
|
}
|
|
@@ -1952,6 +1995,13 @@ export function statementsFromSubproofAssertionNode(subproofAssertionNode, conte
|
|
|
1952
1995
|
return statements;
|
|
1953
1996
|
}
|
|
1954
1997
|
|
|
1998
|
+
export function suppositionsFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, context) {
|
|
1999
|
+
const suppositionNodes = metaLemmaMetathoremNode.getSuppositionNodes(),
|
|
2000
|
+
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
|
|
2001
|
+
|
|
2002
|
+
return suppositions;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
1955
2005
|
export function propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
1956
2006
|
const propertyDeclarationNodes = complexTypeDeclarationNode.getPropertyDeclarationNodes(),
|
|
1957
2007
|
properties = propertiesFromPropertyDeclarationNodes(propertyDeclarationNodes, context);
|
|
@@ -1966,13 +2016,6 @@ export function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationN
|
|
|
1966
2016
|
return superTypes;
|
|
1967
2017
|
}
|
|
1968
2018
|
|
|
1969
|
-
export function suppositionsFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, context) {
|
|
1970
|
-
const suppositionNodes = metaLemmaMetathoremNode.getSuppositionNodes(),
|
|
1971
|
-
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
|
|
1972
|
-
|
|
1973
|
-
return suppositions;
|
|
1974
|
-
}
|
|
1975
|
-
|
|
1976
2019
|
export function labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
|
|
1977
2020
|
const labelNodes = axiomLemmaTheoremConjectureNode.getLabelNodes(),
|
|
1978
2021
|
labels = labelsFromLabelNodes(labelNodes, context);
|
|
@@ -4,50 +4,50 @@ import nominalContext from "../context/nominal";
|
|
|
4
4
|
|
|
5
5
|
import { BASE_TYPE_SYMBOL } from "../constants";
|
|
6
6
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { instantiateCombinator, instantiateConstructor } from "../process/instantiate";
|
|
8
|
+
import { combinatorFromCombinatorNode, constructorFromConstructorNode } from "../utilities/element";
|
|
9
9
|
|
|
10
|
-
let
|
|
11
|
-
|
|
10
|
+
let bracketedCombinator = null,
|
|
11
|
+
bracketedConstructor = null;
|
|
12
12
|
|
|
13
|
-
export function
|
|
14
|
-
if (
|
|
13
|
+
export function bracketedCombinatorFromNothing() {
|
|
14
|
+
if (bracketedCombinator === null) {
|
|
15
15
|
let context;
|
|
16
16
|
|
|
17
|
-
const string = `(${
|
|
17
|
+
const string = `(${STATEMENT_META_TYPE_NAME})`;
|
|
18
18
|
|
|
19
19
|
context = nominalContext; ///
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const combinatorNode = instantiateCombinator(string, context),
|
|
22
|
+
bracketedCombinatorNode = combinatorNode; ///
|
|
23
23
|
|
|
24
24
|
context = {
|
|
25
25
|
nodeAsString: () => string
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
bracketedCombinator = combinatorFromCombinatorNode(bracketedCombinatorNode, context);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
return
|
|
31
|
+
return bracketedCombinator;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export function
|
|
35
|
-
if (
|
|
34
|
+
export function bracketedConstructorFromNothing() {
|
|
35
|
+
if (bracketedConstructor === null) {
|
|
36
36
|
let context;
|
|
37
37
|
|
|
38
|
-
const string = `(${
|
|
38
|
+
const string = `(${BASE_TYPE_SYMBOL})`;
|
|
39
39
|
|
|
40
40
|
context = nominalContext; ///
|
|
41
41
|
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const constructorNode = instantiateConstructor(string, context),
|
|
43
|
+
bracketedConstructorNode = constructorNode; ///
|
|
44
44
|
|
|
45
45
|
context = {
|
|
46
46
|
nodeAsString: () => string
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
bracketedConstructor = constructorFromConstructorNode(bracketedConstructorNode, context);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
return
|
|
52
|
+
return bracketedConstructor;
|
|
53
53
|
}
|
|
@@ -4,7 +4,7 @@ import { equalityFromStatementNode,
|
|
|
4
4
|
judgementFromStatementNode,
|
|
5
5
|
metavariableFromStatementNode,
|
|
6
6
|
typeAssertionFromStatementNode,
|
|
7
|
-
|
|
7
|
+
definedAssertionFromStatementNode,
|
|
8
8
|
propertyAssertionFromStatementNode,
|
|
9
9
|
subproofAssertionFromStatementNode,
|
|
10
10
|
containedAssertionFromStatementNode,
|
|
@@ -40,7 +40,7 @@ export function typeAssertionFromStatement(statement, context) {
|
|
|
40
40
|
|
|
41
41
|
export function definedAssertionFromStatement(statement, context) {
|
|
42
42
|
const statementNode = statement.getNode(),
|
|
43
|
-
definedAssertion =
|
|
43
|
+
definedAssertion = definedAssertionFromStatementNode(statementNode, context);
|
|
44
44
|
|
|
45
45
|
return definedAssertion;
|
|
46
46
|
}
|
package/src/utilities/string.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { baseTypeFromNothing } from "../types";
|
|
4
4
|
|
|
5
5
|
export function termsStringFromTerms(terms) {
|
|
6
6
|
const termsString = terms.reduce((termsString, term) => {
|
|
@@ -59,17 +59,18 @@ export function hypothesesStringFromHypotheses(hypotheses, context) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
export function superTypesStringFromSuperTypes(superTypes) {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const baseType = baseTypeFromNothing(),
|
|
63
|
+
superTypesString = superTypes.reduce((superTypesString, superType) => {
|
|
64
|
+
if (superType !== baseType) {
|
|
65
|
+
const superTypeString = superType.getString();
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
superTypesString = (superTypesString === null) ?
|
|
68
|
+
`'${superTypeString}'` :
|
|
69
|
+
`${superTypesString}, '${superTypeString}'`;
|
|
70
|
+
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
return superTypesString;
|
|
73
|
+
}, null);
|
|
73
74
|
|
|
74
75
|
return superTypesString;
|
|
75
76
|
}
|
|
@@ -116,6 +117,20 @@ export function suppositionsStringFromSuppositions(suppositions) {
|
|
|
116
117
|
return suppositionsString;
|
|
117
118
|
}
|
|
118
119
|
|
|
120
|
+
export function substitutionsStringFromSubstitutions(substitutions) {
|
|
121
|
+
const substitutionsString = substitutions.reduce((substitutionsString, substitution) => {
|
|
122
|
+
const substitutionString = substitution.getString();
|
|
123
|
+
|
|
124
|
+
substitutionsString = (substitutionsString === null) ?
|
|
125
|
+
substitutionString : ///
|
|
126
|
+
`${substitutionsString}, ${substitutionString}`;
|
|
127
|
+
|
|
128
|
+
return substitutionsString;
|
|
129
|
+
}, null);
|
|
130
|
+
|
|
131
|
+
return substitutionsString;
|
|
132
|
+
}
|
|
133
|
+
|
|
119
134
|
export function signatureStringFromTerms(terms) {
|
|
120
135
|
const termsString = termsStringFromTerms(terms),
|
|
121
136
|
signatureString = `[${termsString}]`;
|
|
@@ -130,16 +145,6 @@ export function equivalenceStringFromTerms(terms) {
|
|
|
130
145
|
return equivalenceString;
|
|
131
146
|
}
|
|
132
147
|
|
|
133
|
-
export function subproofStringFromSubproof(subproof) {
|
|
134
|
-
const lastStep = subproof.getLastStep(),
|
|
135
|
-
suppositions = subproof.getSuppositions(),
|
|
136
|
-
lastStepString = lastStep.getString(),
|
|
137
|
-
suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
138
|
-
subproofString = `[${suppositionsString}] ... ${lastStepString}`;
|
|
139
|
-
|
|
140
|
-
return subproofString;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
148
|
export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conclusion) {
|
|
144
149
|
const premisesString = premisesStringFromPremises(premises),
|
|
145
150
|
conclusionString = conclusion.getString(),
|
|
@@ -151,6 +156,15 @@ export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conc
|
|
|
151
156
|
return ruleString;
|
|
152
157
|
}
|
|
153
158
|
|
|
159
|
+
export function subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation) {
|
|
160
|
+
const lastStep = subDerivation.getLastStep(),
|
|
161
|
+
lastStepString = lastStep.getString(),
|
|
162
|
+
suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
163
|
+
subproofString = `[${suppositionsString}] ... ${lastStepString}`;
|
|
164
|
+
|
|
165
|
+
return subproofString;
|
|
166
|
+
}
|
|
167
|
+
|
|
154
168
|
export function typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes) {
|
|
155
169
|
let typeString;
|
|
156
170
|
|