occam-verify-cli 1.0.437 → 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 +5 -8
- 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 +16 -18
- 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 +43 -52
- 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 +26 -50
- package/lib/element/signature.js +11 -11
- package/lib/element/statement.js +54 -56
- package/lib/element/step.js +79 -51
- 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 +27 -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 +100 -61
- package/lib/utilities/instance.js +18 -18
- package/lib/utilities/statement.js +11 -16
- 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 +4 -8
- 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 +14 -21
- 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 +56 -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 +28 -72
- package/src/element/signature.js +10 -9
- package/src/element/statement.js +69 -56
- package/src/element/step.js +89 -51
- 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 +15 -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 +138 -91
- package/src/utilities/instance.js +18 -18
- package/src/utilities/statement.js +27 -28
- package/src/utilities/string.js +34 -20
- package/src/{mixins/step/unify.js → utilities/unification.js} +82 -68
- package/src/utilities/validation.js +369 -0
- package/lib/element/statement/combinator.js +0 -105
- package/lib/element/term/constructor.js +0 -172
- package/lib/mixins/statement/verify.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/statement/verify.js +0 -295
- 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(),
|
|
@@ -40,8 +42,11 @@ export function termFromTermNode(termNode, context) {
|
|
|
40
42
|
const { Term } = elements,
|
|
41
43
|
node = termNode, ///
|
|
42
44
|
string = context.nodeAsString(node),
|
|
43
|
-
type = null
|
|
44
|
-
|
|
45
|
+
type = null;
|
|
46
|
+
|
|
47
|
+
context = null;
|
|
48
|
+
|
|
49
|
+
const term = new Term(context, string, node, type);
|
|
45
50
|
|
|
46
51
|
return term;
|
|
47
52
|
}
|
|
@@ -67,7 +72,7 @@ export function ruleFromRuleNode(ruleNode, context) {
|
|
|
67
72
|
ruleString = rulsStringFromLabelsPremisesAndConclusion(labels, premises, conclusion),
|
|
68
73
|
node = ruleNode, ///
|
|
69
74
|
string = ruleString, ///
|
|
70
|
-
rule = new Rule(context, string, node, labels, premises, conclusion
|
|
75
|
+
rule = new Rule(context, string, node, proof, labels, premises, conclusion);
|
|
71
76
|
|
|
72
77
|
return rule;
|
|
73
78
|
}
|
|
@@ -237,13 +242,13 @@ export function variableFromVariableNode(variableNode, context) {
|
|
|
237
242
|
}
|
|
238
243
|
|
|
239
244
|
export function subproofFromSubproofNode(subproofNode, context) {
|
|
240
|
-
const {
|
|
245
|
+
const { Subproof } = elements,
|
|
241
246
|
node = subproofNode, ///
|
|
242
247
|
suppositions = suppositionsFromSubproofNode(subproofNode, context),
|
|
243
248
|
subDerivation = subDerivationFromSubproofNode(subproofNode, context),
|
|
244
|
-
subproofString =
|
|
249
|
+
subproofString = subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation, context),
|
|
245
250
|
string = subproofString, ///
|
|
246
|
-
subproof = new
|
|
251
|
+
subproof = new Subproof(context, string, node, suppositions, subDerivation);
|
|
247
252
|
|
|
248
253
|
return subproof;
|
|
249
254
|
}
|
|
@@ -278,8 +283,11 @@ export function deductionFromDeductionNode(deductionNode, context) {
|
|
|
278
283
|
export function statementFromStatementNode(statementNode, context) {
|
|
279
284
|
const { Statement } = elements,
|
|
280
285
|
node = statementNode, ///
|
|
281
|
-
string = context.nodeAsString(node)
|
|
282
|
-
|
|
286
|
+
string = context.nodeAsString(node);
|
|
287
|
+
|
|
288
|
+
context = null;
|
|
289
|
+
|
|
290
|
+
const statement = new Statement(context, string, node);
|
|
283
291
|
|
|
284
292
|
return statement;
|
|
285
293
|
}
|
|
@@ -304,23 +312,6 @@ export function referenceFromReferenceNode(referenceNode, context) {
|
|
|
304
312
|
return reference;
|
|
305
313
|
}
|
|
306
314
|
|
|
307
|
-
export function conjectureroConjectureNode(conjectureNode, context) {
|
|
308
|
-
const { Conjecture } = elements,
|
|
309
|
-
axiomLemmaTheoremConjectureNode = conjectureNode, ///
|
|
310
|
-
proof = proofFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
311
|
-
labels = labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
312
|
-
deduction = deductionFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
313
|
-
suppositions = suppositionsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
314
|
-
signature = signatureFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context),
|
|
315
|
-
hypotheses = [],
|
|
316
|
-
axiomLemmaTheoremConjectureString = axiomLemmaTheoremConjectureStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
317
|
-
node = conjectureNode, ///
|
|
318
|
-
string = axiomLemmaTheoremConjectureString, ///
|
|
319
|
-
conjecture = new Conjecture(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
320
|
-
|
|
321
|
-
return conjecture;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
315
|
export function judgementFromJudgementNode(judgementNode, context) {
|
|
325
316
|
const { Judgement } = elements,
|
|
326
317
|
node = judgementNode, ///
|
|
@@ -368,6 +359,33 @@ export function hypothesisFromHypothesisNode(hypotheseNode, context) {
|
|
|
368
359
|
return parameter;
|
|
369
360
|
}
|
|
370
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
|
+
|
|
371
389
|
export function conclusionFromConclusionNode(conclusionNode, context) {
|
|
372
390
|
const { Conclusion } = elements,
|
|
373
391
|
node = conclusionNode, ///
|
|
@@ -455,6 +473,16 @@ export function hyppothesisFromHypothesisNode(hypothesisNode, context) {
|
|
|
455
473
|
return hypothesis
|
|
456
474
|
}
|
|
457
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
|
+
|
|
458
486
|
export function suppositionFromSuppositionNode(suppositionNode, context) {
|
|
459
487
|
const { Supposition } = elements,
|
|
460
488
|
node = suppositionNode, ///
|
|
@@ -696,8 +724,8 @@ export function statementSubstitutionFromStatementSubstitutionNode(statementSubs
|
|
|
696
724
|
node = statementSubstitutionNode, ///
|
|
697
725
|
string = context.nodeAsString(node),
|
|
698
726
|
resolved = true,
|
|
699
|
-
statement =
|
|
700
|
-
metavariable =
|
|
727
|
+
statement = null,
|
|
728
|
+
metavariable = null,
|
|
701
729
|
substitution = null,
|
|
702
730
|
statementSubstitution = new StatementSubstitution(context, string, node, resolved, statement, metavariable, substitution);
|
|
703
731
|
|
|
@@ -870,6 +898,18 @@ export function derivationFromProofNode(proofNode, context) {
|
|
|
870
898
|
return derivation;
|
|
871
899
|
}
|
|
872
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
|
+
|
|
873
913
|
export function statementFromPremiseNode(premiseNode, context) {
|
|
874
914
|
let statement = null;
|
|
875
915
|
|
|
@@ -918,18 +958,6 @@ export function conclusionFromPremiseNode(premiseNode, context) {
|
|
|
918
958
|
return conclusion;
|
|
919
959
|
}
|
|
920
960
|
|
|
921
|
-
export function judgementFomStatementNode(statementNode, context) {
|
|
922
|
-
let judgement = null;
|
|
923
|
-
|
|
924
|
-
const judgementNode = statementNode.getJudgementNode();
|
|
925
|
-
|
|
926
|
-
if (judgementNode !== null) {
|
|
927
|
-
judgement = judgementFromJudgementNode(judgementNode, context);
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
return judgement;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
961
|
export function termFromTypeAssertionNode(typeAssertionNode, context) {
|
|
934
962
|
let term = null;
|
|
935
963
|
|
|
@@ -985,6 +1013,18 @@ export function statementFromDeductionNode(deductionNode, context) {
|
|
|
985
1013
|
return statement;
|
|
986
1014
|
}
|
|
987
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
|
+
|
|
988
1028
|
export function stepFromStepOrSubproofNode(stepOrSubproofNode, context) {
|
|
989
1029
|
let step = null;
|
|
990
1030
|
|
|
@@ -999,6 +1039,18 @@ export function stepFromStepOrSubproofNode(stepOrSubproofNode, context) {
|
|
|
999
1039
|
return step;
|
|
1000
1040
|
}
|
|
1001
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
|
+
|
|
1002
1054
|
export function statementFromConclusionNode(conclusinoNode, context) {
|
|
1003
1055
|
let statement = null;
|
|
1004
1056
|
|
|
@@ -1122,11 +1174,9 @@ export function termFromTermSubstitutionNode(termSubstitutionNode, context) {
|
|
|
1122
1174
|
export function metavariableFromStatementNode(statementNode, context) {
|
|
1123
1175
|
let metavariable = null;
|
|
1124
1176
|
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
if (singularMetavariableNode !== null) {
|
|
1128
|
-
const metavariableNode = singularMetavariableNode; ///
|
|
1177
|
+
const metavariableNode = statementNode.getMetavariableNode();
|
|
1129
1178
|
|
|
1179
|
+
if (metavariableNode !== null) {
|
|
1130
1180
|
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
1131
1181
|
}
|
|
1132
1182
|
|
|
@@ -1145,18 +1195,6 @@ export function subDerivationFromSubproofNode(subproofNode, context) {
|
|
|
1145
1195
|
return subDerviation;
|
|
1146
1196
|
}
|
|
1147
1197
|
|
|
1148
|
-
export function typeAssertinFromStatementNode(statementNode, context) {
|
|
1149
|
-
let typeAssertion = null;
|
|
1150
|
-
|
|
1151
|
-
const typeAssertionNode = statementNode.getTypeAssertionNode();
|
|
1152
|
-
|
|
1153
|
-
if (typeAssertionNode !== null) {
|
|
1154
|
-
typeAssertion = typeAssertionFromTypeAssertionNode(typeAssertionNode, context);
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
return typeAssertion;
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
1198
|
export function metavariableFromReferenceNode(referenceNode, context) {
|
|
1161
1199
|
let metavariable = null;
|
|
1162
1200
|
|
|
@@ -1211,6 +1249,18 @@ export function parameterNameFromParameterNode(parameterNode, context) {
|
|
|
1211
1249
|
return parameterName;
|
|
1212
1250
|
}
|
|
1213
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
|
+
|
|
1214
1264
|
export function metavariableFromAssumptionNode(assumptionNode, context) {
|
|
1215
1265
|
let metavariable = null;
|
|
1216
1266
|
|
|
@@ -1297,6 +1347,18 @@ export function frameFromContainedAssertionNode(containedAssertionNode, context)
|
|
|
1297
1347
|
return frame;
|
|
1298
1348
|
}
|
|
1299
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
|
+
|
|
1300
1362
|
export function propertyFromPropertyRelationNode(propertyRelationNode, context) {
|
|
1301
1363
|
let property = null;
|
|
1302
1364
|
|
|
@@ -1321,18 +1383,6 @@ export function variableFromTermSubstitutionNode(termSubstitutionNode, context)
|
|
|
1321
1383
|
return variable;
|
|
1322
1384
|
}
|
|
1323
1385
|
|
|
1324
|
-
export function procedureCallFromSuppositionNode(suppositionNode, context) {
|
|
1325
|
-
let procedureCall = null;
|
|
1326
|
-
|
|
1327
|
-
const procedureCallNode = suppositionNode.getProcedureCallNode();
|
|
1328
|
-
|
|
1329
|
-
if (procedureCallNode !== null) {
|
|
1330
|
-
procedureCall = procedureCallFromProcedureCallNode(procedureCallNode, context);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
return procedureCall;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
1386
|
export function definedAssertionFromStatementNode(statementNode, context) {
|
|
1337
1387
|
let definedAssertion = null;
|
|
1338
1388
|
|
|
@@ -1472,7 +1522,9 @@ export function typeFromConstructorDeclarationNode(constructorDeclarationNode, c
|
|
|
1472
1522
|
if (typeNode !== null) {
|
|
1473
1523
|
type = typeFromTypeNode(typeNode, context);
|
|
1474
1524
|
} else {
|
|
1475
|
-
|
|
1525
|
+
const baseType = baseTypeFromNothing();
|
|
1526
|
+
|
|
1527
|
+
type = baseType; ///
|
|
1476
1528
|
}
|
|
1477
1529
|
|
|
1478
1530
|
return type;
|
|
@@ -1660,13 +1712,10 @@ export function typePrefixFromTypePrefixDeclarationNode(typePrefixDeclarationNod
|
|
|
1660
1712
|
export function combinatorFromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
|
|
1661
1713
|
let combinator = null;
|
|
1662
1714
|
|
|
1663
|
-
const
|
|
1664
|
-
|
|
1665
|
-
if (statementNode !== null) {
|
|
1666
|
-
const { Combinator } = elements,
|
|
1667
|
-
statement = statementFromStatementNode(statementNode, context);
|
|
1715
|
+
const combinatorNode = combinatorDeclarationNode.getCombinatorNode();
|
|
1668
1716
|
|
|
1669
|
-
|
|
1717
|
+
if (combinatorNode !== null) {
|
|
1718
|
+
combinator = combinatorFromCombinatorNode(combinatorNode, context);
|
|
1670
1719
|
}
|
|
1671
1720
|
|
|
1672
1721
|
return combinator;
|
|
@@ -1711,13 +1760,10 @@ export function propertyRelationFromPropertyAssertionNode(propertyAssertionNode,
|
|
|
1711
1760
|
export function constructorFromConstructorDeclarationNode(constructorDeclarationNode, context) {
|
|
1712
1761
|
let constructor = null;
|
|
1713
1762
|
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
-
if (termNode !== null) {
|
|
1717
|
-
const { Constructor } = elements,
|
|
1718
|
-
term = termFromTermNode(termNode, context);
|
|
1763
|
+
const constructorNode = constructorDeclarationNode.getConstructorNode();
|
|
1719
1764
|
|
|
1720
|
-
|
|
1765
|
+
if (constructorNode !== null) {
|
|
1766
|
+
constructor = constructorFromConstructorNode(constructorNode, context);
|
|
1721
1767
|
}
|
|
1722
1768
|
|
|
1723
1769
|
return constructor;
|
|
@@ -1834,7 +1880,8 @@ export function superTypesFromSuperTypeNodes(superTypeNodes, context) {
|
|
|
1834
1880
|
superTypesLength = superTypes.length;
|
|
1835
1881
|
|
|
1836
1882
|
if (superTypesLength === 0) {
|
|
1837
|
-
const
|
|
1883
|
+
const baseType = baseTypeFromNothing(),
|
|
1884
|
+
superType = baseType; ///
|
|
1838
1885
|
|
|
1839
1886
|
superTypes.push(superType);
|
|
1840
1887
|
}
|
|
@@ -1948,6 +1995,13 @@ export function statementsFromSubproofAssertionNode(subproofAssertionNode, conte
|
|
|
1948
1995
|
return statements;
|
|
1949
1996
|
}
|
|
1950
1997
|
|
|
1998
|
+
export function suppositionsFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, context) {
|
|
1999
|
+
const suppositionNodes = metaLemmaMetathoremNode.getSuppositionNodes(),
|
|
2000
|
+
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
|
|
2001
|
+
|
|
2002
|
+
return suppositions;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
1951
2005
|
export function propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
|
|
1952
2006
|
const propertyDeclarationNodes = complexTypeDeclarationNode.getPropertyDeclarationNodes(),
|
|
1953
2007
|
properties = propertiesFromPropertyDeclarationNodes(propertyDeclarationNodes, context);
|
|
@@ -1962,13 +2016,6 @@ export function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationN
|
|
|
1962
2016
|
return superTypes;
|
|
1963
2017
|
}
|
|
1964
2018
|
|
|
1965
|
-
export function suppositionsFromMetaLemmaMetatheoremNode(metaLemmaMetathoremNode, context) {
|
|
1966
|
-
const suppositionNodes = metaLemmaMetathoremNode.getSuppositionNodes(),
|
|
1967
|
-
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context);
|
|
1968
|
-
|
|
1969
|
-
return suppositions;
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
2019
|
export function labelsFromAxiomLemmaTheoremConjectureNode(axiomLemmaTheoremConjectureNode, context) {
|
|
1973
2020
|
const labelNodes = axiomLemmaTheoremConjectureNode.getLabelNodes(),
|
|
1974
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
|
}
|
|
@@ -1,75 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { equalityFromStatementNode,
|
|
4
|
+
judgementFromStatementNode,
|
|
5
|
+
metavariableFromStatementNode,
|
|
6
|
+
typeAssertionFromStatementNode,
|
|
7
|
+
definedAssertionFromStatementNode,
|
|
8
|
+
propertyAssertionFromStatementNode,
|
|
9
|
+
subproofAssertionFromStatementNode,
|
|
10
|
+
containedAssertionFromStatementNode,
|
|
11
|
+
satisfiesAssertionFromStatementNode } from "../utilities/element";
|
|
4
12
|
|
|
5
13
|
export function equalityFromStatement(statement, context) {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
equality = Equality.fromStatementNode(statementNode, context);
|
|
14
|
+
const statementNode = statement.getNode(),
|
|
15
|
+
equality = equalityFromStatementNode(statementNode, context);
|
|
9
16
|
|
|
10
17
|
return equality;
|
|
11
18
|
}
|
|
12
19
|
|
|
13
20
|
export function judgementFromStatement(statement, context) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
judgement = Judgement.fromStatementNode(statementNode, context);
|
|
21
|
+
const statementNode = statement.getNode(),
|
|
22
|
+
judgement = judgementFromStatementNode(statementNode, context);
|
|
17
23
|
|
|
18
24
|
return judgement;
|
|
19
25
|
}
|
|
20
26
|
|
|
21
27
|
export function metavariableFromStatement(statement, context) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
metavariable = Metavariable.fromStatementNode(statementNode, context);
|
|
28
|
+
const statementNode = statement.getNode(),
|
|
29
|
+
metavariable = metavariableFromStatementNode(statementNode, context);
|
|
25
30
|
|
|
26
31
|
return metavariable;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
export function typeAssertionFromStatement(statement, context) {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
typeAssertion = TypeAssertion.fromStatementNode(statementNode, context);
|
|
35
|
+
const statementNode = statement.getNode(),
|
|
36
|
+
typeAssertion = typeAssertionFromStatementNode(statementNode, context);
|
|
33
37
|
|
|
34
38
|
return typeAssertion;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export function definedAssertionFromStatement(statement, context) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
definedAssertion = DefinedAssertion.fromStatementNode(statementNode, context);
|
|
42
|
+
const statementNode = statement.getNode(),
|
|
43
|
+
definedAssertion = definedAssertionFromStatementNode(statementNode, context);
|
|
41
44
|
|
|
42
45
|
return definedAssertion;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
export function propertyAssertionFromStatement(statement, context) {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
propertyAssertion = PropertyAssertion.fromStatementNode(statementNode, context);
|
|
49
|
+
const statementNode = statement.getNode(),
|
|
50
|
+
propertyAssertion = propertyAssertionFromStatementNode(statementNode, context);
|
|
49
51
|
|
|
50
52
|
return propertyAssertion;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export function subproofAssertionFromStatement(statement, context) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, context);
|
|
56
|
+
const statementNode = statement.getNode(),
|
|
57
|
+
subproofAssertion = subproofAssertionFromStatementNode(statementNode, context);
|
|
57
58
|
|
|
58
59
|
return subproofAssertion;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
export function containedAssertionFromStatement(statement, context) {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
containedAssertion = ContainedAssertion.fromStatementNode(statementNode, context);
|
|
63
|
+
const statementNode = statement.getNode(),
|
|
64
|
+
containedAssertion = containedAssertionFromStatementNode(statementNode, context);
|
|
65
65
|
|
|
66
66
|
return containedAssertion;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export function satisfiesAssertionFromStatement(statement, context) {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
satisfiesAssertion = SatisfiesAssertion.fromStatementNode(statementNode, context);
|
|
70
|
+
const statementNode = statement.getNode(),
|
|
71
|
+
satisfiesAssertion = satisfiesAssertionFromStatementNode(statementNode, context);
|
|
73
72
|
|
|
74
73
|
return satisfiesAssertion;
|
|
75
74
|
}
|
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
|
|