occam-verify-cli 1.0.388 → 1.0.404
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/action/verify.js +3 -3
- package/lib/assignment/equality.js +2 -2
- package/lib/context/file.js +11 -11
- package/lib/context/local.js +38 -61
- package/lib/context/partial.js +10 -10
- package/lib/context/temporary.js +755 -0
- package/lib/mixins/statement/verify.js +38 -16
- package/lib/mixins/step/unify.js +7 -8
- package/lib/node/argument.js +4 -4
- package/lib/node/assertion/contained.js +6 -6
- package/lib/node/assertion/defined.js +6 -6
- package/lib/node/assertion/property.js +6 -6
- package/lib/node/assertion/satisfies.js +6 -6
- package/lib/node/assertion/subproof.js +6 -6
- package/lib/node/assertion/type.js +6 -6
- package/lib/node/assertion.js +107 -0
- package/lib/node/assumption.js +134 -0
- package/lib/node/axiom.js +6 -6
- package/lib/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +12 -12
- package/lib/node/body.js +4 -5
- package/lib/node/combinator.js +4 -4
- package/lib/node/conclusion.js +4 -4
- package/lib/node/conjecture.js +6 -6
- package/lib/node/constructor.js +4 -4
- package/lib/node/declaration/combinator.js +6 -6
- package/lib/node/declaration/complexType.js +6 -6
- package/lib/node/declaration/constructor.js +6 -6
- package/lib/node/declaration/metavariable.js +6 -6
- package/lib/node/declaration/property.js +6 -6
- package/lib/node/declaration/simpleType.js +6 -6
- package/lib/node/declaration/typePrefix.js +6 -6
- package/lib/node/declaration/variable.js +6 -6
- package/lib/node/declaration.js +6 -22
- package/lib/node/deduction.js +4 -4
- package/lib/node/derivation.js +4 -4
- package/lib/node/document.js +107 -0
- package/lib/node/equality.js +4 -4
- package/lib/node/error.js +4 -4
- package/lib/node/frame.js +25 -14
- package/lib/node/header.js +4 -4
- package/lib/node/hypothesis.js +4 -4
- package/lib/node/judgement.js +8 -8
- package/lib/node/label.js +4 -4
- package/lib/node/labels.js +4 -4
- package/lib/node/lemma.js +6 -6
- package/lib/node/metaArgument.js +4 -4
- package/lib/node/metaLemma.js +6 -6
- package/lib/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +12 -12
- package/lib/node/metaType.js +4 -4
- package/lib/node/metatheorem.js +6 -6
- package/lib/node/metavariable.js +4 -4
- package/lib/node/nonsense.js +4 -4
- package/lib/node/parameter.js +4 -4
- package/lib/node/parenthesisedLabel.js +4 -4
- package/lib/node/parenthesisedLabels.js +4 -4
- package/lib/node/placeholder.js +107 -0
- package/lib/node/premise.js +4 -4
- package/lib/node/procedureCall.js +4 -4
- package/lib/node/procedureReference.js +4 -4
- package/lib/node/proof.js +4 -4
- package/lib/node/property.js +4 -4
- package/lib/node/propertyRelation.js +4 -4
- package/lib/node/qualification.js +4 -4
- package/lib/node/reference.js +4 -4
- package/lib/node/rule.js +4 -4
- package/lib/node/section.js +4 -4
- package/lib/node/signature.js +4 -4
- package/lib/node/statement.js +15 -4
- package/lib/node/step.js +4 -4
- package/lib/node/subDerivation.js +4 -4
- package/lib/node/subproof.js +4 -4
- package/lib/node/substitution/frame.js +28 -6
- package/lib/node/substitution/statement.js +6 -6
- package/lib/node/substitution/term.js +28 -6
- package/lib/node/substitution.js +107 -0
- package/lib/node/supposition.js +4 -4
- package/lib/node/term.js +27 -4
- package/lib/node/theorem.js +6 -6
- package/lib/node/type.js +4 -4
- package/lib/node/typePrefix.js +4 -4
- package/lib/node/types.js +4 -4
- package/lib/node/variable.js +4 -4
- package/lib/nominal/parser.js +3 -3
- package/lib/nonTerminalNode.js +222 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ontology/assertion/contained.js +80 -39
- package/lib/ontology/assertion/defined.js +80 -39
- package/lib/ontology/assertion/property.js +71 -29
- package/lib/ontology/assertion/satisfies.js +73 -25
- package/lib/ontology/assertion/subproof.js +95 -41
- package/lib/ontology/assertion/type.js +74 -18
- package/lib/ontology/assertion.js +66 -0
- package/lib/ontology/assumption.js +379 -0
- package/lib/ontology/axiom.js +8 -11
- package/lib/ontology/combinator/bracketed.js +17 -3
- package/lib/ontology/combinator.js +17 -3
- package/lib/ontology/conclusion.js +38 -9
- package/lib/ontology/constructor/bracketed.js +17 -3
- package/lib/ontology/constructor.js +17 -3
- package/lib/ontology/declaration/combinator.js +75 -33
- package/lib/ontology/declaration/complexType.js +110 -63
- package/lib/ontology/declaration/constructor.js +81 -38
- package/lib/ontology/declaration/metavariable.js +87 -39
- package/lib/ontology/declaration/simpleType.js +95 -48
- package/lib/ontology/declaration/typePrefix.js +87 -40
- package/lib/ontology/declaration/variable.js +87 -39
- package/lib/ontology/declaration.js +13 -313
- package/lib/ontology/deduction.js +38 -9
- package/lib/ontology/equivalence.js +295 -0
- package/lib/ontology/equivalences.js +264 -0
- package/lib/ontology/frame.js +83 -51
- package/lib/ontology/hypothesis.js +11 -11
- package/lib/ontology/judgement.js +8 -8
- package/lib/ontology/label.js +5 -6
- package/lib/ontology/metavariable.js +14 -15
- package/lib/ontology/premise.js +60 -21
- package/lib/ontology/procedureCall.js +15 -15
- package/lib/ontology/procedureReference.js +1 -1
- package/lib/ontology/proof.js +2 -2
- package/lib/ontology/reference.js +6 -13
- package/lib/ontology/rule.js +69 -71
- package/lib/ontology/section.js +2 -2
- package/lib/ontology/signature.js +2 -2
- package/lib/ontology/statement.js +36 -24
- package/lib/ontology/step.js +38 -26
- package/lib/ontology/subproof.js +12 -13
- package/lib/ontology/substitution/frame.js +69 -21
- package/lib/ontology/substitution/reference.js +24 -9
- package/lib/ontology/substitution/statement.js +137 -76
- package/lib/ontology/substitution/term.js +75 -35
- package/lib/ontology/substitution.js +50 -44
- package/lib/ontology/substitutions.js +425 -0
- package/lib/ontology/supposition.js +69 -29
- package/lib/ontology/term.js +35 -37
- package/lib/ontology/topLevelAssertion.js +16 -17
- package/lib/ontology/topLevelMetaAssertion.js +3 -4
- package/lib/ontology/variable.js +9 -14
- package/lib/preamble.js +7 -4
- package/lib/ruleNames.js +20 -12
- package/lib/unifier/intrinsicLevel.js +4 -5
- package/lib/unifier/metaLevel.js +24 -24
- package/lib/utilities/brackets.js +4 -21
- package/lib/utilities/context.js +6 -6
- package/lib/utilities/frame.js +18 -0
- package/lib/utilities/json.js +24 -1
- package/lib/utilities/metavariable.js +18 -0
- package/lib/utilities/statement.js +18 -0
- package/lib/utilities/substitutions.js +43 -30
- package/lib/utilities/unification.js +10 -16
- package/lib/utilities/variable.js +18 -0
- package/package.json +10 -10
- package/src/action/verify.js +2 -2
- package/src/assignment/equality.js +1 -1
- package/src/context/file.js +13 -11
- package/src/context/local.js +40 -65
- package/src/context/partial.js +9 -14
- package/src/context/temporary.js +463 -0
- package/src/mixins/statement/verify.js +60 -23
- package/src/mixins/step/unify.js +6 -6
- package/src/node/argument.js +1 -1
- package/src/node/assertion/contained.js +3 -3
- package/src/node/assertion/defined.js +3 -3
- package/src/node/assertion/property.js +3 -3
- package/src/node/assertion/satisfies.js +3 -3
- package/src/node/assertion/subproof.js +3 -3
- package/src/node/assertion/type.js +3 -3
- package/src/node/assertion.js +7 -0
- package/src/node/assumption.js +35 -0
- package/src/node/axiom.js +3 -3
- package/src/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +2 -2
- package/src/node/body.js +1 -3
- package/src/node/combinator.js +1 -1
- package/src/node/conclusion.js +1 -1
- package/src/node/conjecture.js +3 -3
- package/src/node/constructor.js +1 -1
- package/src/node/declaration/combinator.js +3 -3
- package/src/node/declaration/complexType.js +3 -3
- package/src/node/declaration/constructor.js +3 -3
- package/src/node/declaration/metavariable.js +3 -3
- package/src/node/declaration/property.js +3 -3
- package/src/node/declaration/simpleType.js +3 -3
- package/src/node/declaration/typePrefix.js +3 -3
- package/src/node/declaration/variable.js +3 -3
- package/src/node/declaration.js +2 -18
- package/src/node/deduction.js +1 -1
- package/src/node/derivation.js +1 -1
- package/src/node/document.js +7 -0
- package/src/node/equality.js +1 -1
- package/src/node/error.js +1 -1
- package/src/node/frame.js +23 -11
- package/src/node/header.js +1 -1
- package/src/node/hypothesis.js +1 -1
- package/src/node/judgement.js +6 -6
- package/src/node/label.js +1 -1
- package/src/node/labels.js +1 -1
- package/src/node/lemma.js +3 -3
- package/src/node/metaArgument.js +1 -1
- package/src/node/metaLemma.js +3 -3
- package/src/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +2 -2
- package/src/node/metaType.js +1 -1
- package/src/node/metatheorem.js +3 -3
- package/src/node/metavariable.js +1 -1
- package/src/node/nonsense.js +1 -1
- package/src/node/parameter.js +1 -1
- package/src/node/parenthesisedLabel.js +1 -1
- package/src/node/parenthesisedLabels.js +1 -1
- package/src/node/placeholder.js +7 -0
- package/src/node/premise.js +1 -1
- package/src/node/procedureCall.js +1 -1
- package/src/node/procedureReference.js +1 -1
- package/src/node/proof.js +1 -1
- package/src/node/property.js +1 -1
- package/src/node/propertyRelation.js +1 -1
- package/src/node/qualification.js +1 -1
- package/src/node/reference.js +1 -1
- package/src/node/rule.js +2 -2
- package/src/node/section.js +1 -1
- package/src/node/signature.js +1 -1
- package/src/node/statement.js +13 -1
- package/src/node/step.js +1 -1
- package/src/node/subDerivation.js +1 -1
- package/src/node/subproof.js +1 -1
- package/src/node/substitution/frame.js +29 -3
- package/src/node/substitution/statement.js +3 -3
- package/src/node/substitution/term.js +29 -3
- package/src/node/substitution.js +7 -0
- package/src/node/supposition.js +1 -1
- package/src/node/term.js +27 -1
- package/src/node/theorem.js +3 -3
- package/src/node/type.js +1 -1
- package/src/node/typePrefix.js +1 -1
- package/src/node/types.js +1 -1
- package/src/node/variable.js +1 -1
- package/src/nominal/parser.js +2 -2
- package/src/{node/nonTerminal.js → nonTerminalNode.js} +31 -25
- package/src/nonTerminalNodeMap.js +10 -5
- package/src/ontology/assertion/contained.js +21 -32
- package/src/ontology/assertion/defined.js +20 -31
- package/src/ontology/assertion/property.js +7 -20
- package/src/ontology/assertion/satisfies.js +8 -16
- package/src/ontology/assertion/subproof.js +36 -42
- package/src/ontology/assertion/type.js +10 -11
- package/src/ontology/assertion.js +23 -0
- package/src/ontology/assumption.js +385 -0
- package/src/ontology/axiom.js +7 -16
- package/src/ontology/combinator/bracketed.js +2 -0
- package/src/ontology/combinator.js +2 -0
- package/src/ontology/conclusion.js +51 -10
- package/src/ontology/constructor/bracketed.js +2 -0
- package/src/ontology/constructor.js +2 -0
- package/src/ontology/declaration/combinator.js +15 -24
- package/src/ontology/declaration/complexType.js +57 -53
- package/src/ontology/declaration/constructor.js +25 -31
- package/src/ontology/declaration/metavariable.js +25 -30
- package/src/ontology/declaration/simpleType.js +34 -38
- package/src/ontology/declaration/typePrefix.js +23 -31
- package/src/ontology/declaration/variable.js +26 -31
- package/src/ontology/declaration.js +8 -339
- package/src/ontology/deduction.js +51 -10
- package/src/{equivalence.js → ontology/equivalence.js} +4 -3
- package/src/{equivalences.js → ontology/equivalences.js} +14 -12
- package/src/ontology/frame.js +93 -66
- package/src/ontology/hypothesis.js +8 -8
- package/src/ontology/judgement.js +8 -8
- package/src/ontology/label.js +2 -7
- package/src/ontology/metavariable.js +14 -17
- package/src/ontology/premise.js +82 -25
- package/src/ontology/procedureCall.js +14 -14
- package/src/ontology/procedureReference.js +2 -2
- package/src/ontology/proof.js +1 -1
- package/src/ontology/reference.js +5 -9
- package/src/ontology/rule.js +79 -82
- package/src/ontology/section.js +1 -1
- package/src/ontology/signature.js +1 -1
- package/src/ontology/statement.js +37 -27
- package/src/ontology/step.js +45 -28
- package/src/ontology/subproof.js +10 -10
- package/src/ontology/substitution/frame.js +72 -26
- package/src/ontology/substitution/reference.js +8 -6
- package/src/ontology/substitution/statement.js +95 -76
- package/src/ontology/substitution/term.js +81 -41
- package/src/ontology/substitution.js +35 -34
- package/src/{substitutions.js → ontology/substitutions.js} +29 -28
- package/src/ontology/supposition.js +88 -28
- package/src/ontology/term.js +31 -43
- package/src/ontology/topLevelAssertion.js +16 -18
- package/src/ontology/topLevelMetaAssertion.js +3 -3
- package/src/ontology/variable.js +10 -17
- package/src/preamble.js +6 -3
- package/src/ruleNames.js +10 -8
- package/src/unifier/intrinsicLevel.js +5 -6
- package/src/unifier/metaLevel.js +32 -29
- package/src/utilities/brackets.js +3 -29
- package/src/utilities/context.js +5 -5
- package/src/utilities/frame.js +13 -0
- package/src/utilities/json.js +28 -0
- package/src/utilities/metavariable.js +13 -0
- package/src/utilities/statement.js +13 -0
- package/src/utilities/substitutions.js +59 -33
- package/src/utilities/unification.js +8 -24
- package/src/utilities/variable.js +13 -0
- package/lib/equivalence.js +0 -294
- package/lib/equivalences.js +0 -263
- package/lib/node/nonTerminal.js +0 -218
- package/lib/substitutions.js +0 -424
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-verify-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.404",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.36",
|
|
14
|
-
"necessary": "^
|
|
15
|
-
"occam-custom-grammars": "^5.0.
|
|
16
|
-
"occam-entities": "^1.0.
|
|
17
|
-
"occam-file-system": "^6.0.
|
|
18
|
-
"occam-furtle": "^2.0.
|
|
19
|
-
"occam-grammars": "^1.3.
|
|
20
|
-
"occam-lexers": "^23.1.
|
|
21
|
-
"occam-parsers": "^23.1.
|
|
22
|
-
"occam-query": "^4.1.
|
|
14
|
+
"necessary": "^16.0.3",
|
|
15
|
+
"occam-custom-grammars": "^5.0.1322",
|
|
16
|
+
"occam-entities": "^1.0.431",
|
|
17
|
+
"occam-file-system": "^6.0.446",
|
|
18
|
+
"occam-furtle": "^2.0.265",
|
|
19
|
+
"occam-grammars": "^1.3.414",
|
|
20
|
+
"occam-lexers": "^23.1.22",
|
|
21
|
+
"occam-parsers": "^23.1.25",
|
|
22
|
+
"occam-query": "^4.1.131"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@swc/core": "1.13.20",
|
package/src/action/verify.js
CHANGED
|
@@ -51,9 +51,9 @@ export default function verifyAction(argument, log) {
|
|
|
51
51
|
|
|
52
52
|
const dependentName = null,
|
|
53
53
|
dependentReleased = false,
|
|
54
|
-
|
|
54
|
+
releaseVerifies = verifyRelease(releaseName, dependentName, dependentReleased, releaseContextMap);
|
|
55
55
|
|
|
56
|
-
if (!
|
|
56
|
+
if (!releaseVerifies) {
|
|
57
57
|
log.warning(`The '${name}' project or package cannot be verified.`);
|
|
58
58
|
|
|
59
59
|
return;
|
|
@@ -10,7 +10,7 @@ export default class EqualityAssignment {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
assign(context) {
|
|
13
|
-
const equalityAdded = context.addEquality(this.equality
|
|
13
|
+
const equalityAdded = context.addEquality(this.equality),
|
|
14
14
|
equalityString = this.equality.getString(),
|
|
15
15
|
equalityAssigned = equalityAdded; ///
|
|
16
16
|
|
package/src/context/file.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import Substitutions from "../substitutions";
|
|
5
|
+
import ontology from "../ontology";
|
|
7
6
|
import topLevelVerifier from "../verifier/topLevel";
|
|
8
7
|
|
|
9
8
|
import { baseType } from "../ontology/type";
|
|
@@ -92,7 +91,8 @@ export default class FileContext {
|
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
getEquivalences() {
|
|
95
|
-
const
|
|
94
|
+
const { Equivalences } = ontology,
|
|
95
|
+
equivalences = Equivalences.fromNothing();
|
|
96
96
|
|
|
97
97
|
return equivalences;
|
|
98
98
|
}
|
|
@@ -496,16 +496,17 @@ export default class FileContext {
|
|
|
496
496
|
return axiomLemmaTheoremOrConjecture;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
findMetavariable(metavariable
|
|
500
|
-
const
|
|
501
|
-
|
|
499
|
+
findMetavariable(metavariable) {
|
|
500
|
+
const metavariables = this.getMetavariables(),
|
|
501
|
+
specificMetavariable = metavariable; ///
|
|
502
502
|
|
|
503
503
|
metavariable = metavariables.find((metavariable) => {
|
|
504
504
|
const generalMetavariable = metavariable; ///
|
|
505
505
|
|
|
506
506
|
metavariable = specificMetavariable; ///
|
|
507
507
|
|
|
508
|
-
const
|
|
508
|
+
const context = this, ///
|
|
509
|
+
metavariableUnifies = generalMetavariable.unifyMetavariable(metavariable, context);
|
|
509
510
|
|
|
510
511
|
if (metavariableUnifies) {
|
|
511
512
|
return true;
|
|
@@ -627,7 +628,7 @@ export default class FileContext {
|
|
|
627
628
|
findLabelByMetavariable(metavariable) {
|
|
628
629
|
const labels = this.getLabels(),
|
|
629
630
|
label = labels.find((label) => {
|
|
630
|
-
const metavariableEqualToLabelMetavariable = label.
|
|
631
|
+
const metavariableEqualToLabelMetavariable = label.isMetavariableEqualToMetavariable(metavariable);
|
|
631
632
|
|
|
632
633
|
if (metavariableEqualToLabelMetavariable) {
|
|
633
634
|
return true;
|
|
@@ -668,8 +669,8 @@ export default class FileContext {
|
|
|
668
669
|
return metavariable;
|
|
669
670
|
}
|
|
670
671
|
|
|
671
|
-
isMetavariablePresent(metavariable
|
|
672
|
-
metavariable = this.findMetavariable(metavariable
|
|
672
|
+
isMetavariablePresent(metavariable) {
|
|
673
|
+
metavariable = this.findMetavariable(metavariable);
|
|
673
674
|
|
|
674
675
|
const metavariablePresent = (metavariable !== null);
|
|
675
676
|
|
|
@@ -735,7 +736,8 @@ export default class FileContext {
|
|
|
735
736
|
isLabelPresentByReference(reference) {
|
|
736
737
|
const labels = this.getLabels(),
|
|
737
738
|
labelPresent = labels.some((label) => {
|
|
738
|
-
const
|
|
739
|
+
const { Substitutions } = ontology,
|
|
740
|
+
context = this, ///
|
|
739
741
|
substitutions = Substitutions.fromNothing(),
|
|
740
742
|
labelUnifies = reference.unifyLabel(label, substitutions, context);
|
|
741
743
|
|
package/src/context/local.js
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import Equivalences from "../equivalences";
|
|
5
|
+
import ontology from "../ontology";
|
|
7
6
|
|
|
8
7
|
const { last } = arrayUtilities;
|
|
9
8
|
|
|
10
9
|
class LocalContext {
|
|
11
|
-
constructor(context,
|
|
10
|
+
constructor(context, variables, judgements, equivalences, stepsOrSubproofs) {
|
|
12
11
|
this.context = context;
|
|
13
|
-
this.tokens = tokens;
|
|
14
12
|
this.variables = variables;
|
|
15
13
|
this.judgements = judgements;
|
|
16
14
|
this.equivalences = equivalences;
|
|
@@ -21,10 +19,6 @@ class LocalContext {
|
|
|
21
19
|
return this.context;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
getTokens() {
|
|
25
|
-
return this.tokens;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
22
|
getVariables(nested = true) {
|
|
29
23
|
let variables;
|
|
30
24
|
|
|
@@ -124,19 +118,28 @@ class LocalContext {
|
|
|
124
118
|
|
|
125
119
|
addTheorem(theorem) { this.context.addTheorem(theorem); }
|
|
126
120
|
|
|
127
|
-
addEquality(equality
|
|
121
|
+
addEquality(equality) {
|
|
128
122
|
let equalityAdded;
|
|
129
123
|
|
|
130
124
|
const equalityReflexive = equality.isReflexive();
|
|
131
125
|
|
|
132
126
|
if (!equalityReflexive) {
|
|
133
|
-
const
|
|
127
|
+
const { Equivalence } = ontology,
|
|
128
|
+
equivalence = Equivalence.fromEquality(equality),
|
|
129
|
+
context = this; ///
|
|
134
130
|
|
|
135
131
|
this.equivalences = this.equivalences.mergedWithEquivalence(equivalence, context);
|
|
136
132
|
}
|
|
137
133
|
|
|
138
134
|
equalityAdded = true;
|
|
139
135
|
|
|
136
|
+
if (equalityAdded) {
|
|
137
|
+
const context = this, ///
|
|
138
|
+
equalityString = equality.getString();
|
|
139
|
+
|
|
140
|
+
context.trace(`Added the '${equalityString}' equality.`)
|
|
141
|
+
}
|
|
142
|
+
|
|
140
143
|
return equalityAdded;
|
|
141
144
|
}
|
|
142
145
|
|
|
@@ -152,11 +155,14 @@ class LocalContext {
|
|
|
152
155
|
variableAdded = true;
|
|
153
156
|
}
|
|
154
157
|
|
|
155
|
-
|
|
156
|
-
|
|
158
|
+
if (variableAdded) {
|
|
159
|
+
const context = this,
|
|
160
|
+
variableString = variable.getString();
|
|
157
161
|
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
context.trace(`Added the '${variableString}' variable.`)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return variableAdded;
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
addJudgement(judgement) {
|
|
@@ -171,9 +177,20 @@ class LocalContext {
|
|
|
171
177
|
judgementAdded = true;
|
|
172
178
|
}
|
|
173
179
|
|
|
180
|
+
if (judgementAdded) {
|
|
181
|
+
const context = this, ///
|
|
182
|
+
judgementString = judgement.getString();
|
|
183
|
+
|
|
184
|
+
context.trace(`Added the '${judgementString}' judgement.`)
|
|
185
|
+
}
|
|
186
|
+
|
|
174
187
|
return judgementAdded;
|
|
175
188
|
}
|
|
176
189
|
|
|
190
|
+
addStepOrSubproof(stepOrSubproof) {
|
|
191
|
+
this.stepsOrSubproofs.push(stepOrSubproof);
|
|
192
|
+
}
|
|
193
|
+
|
|
177
194
|
findProcedureByName(name) { return this.context.findProcedureByName(name); }
|
|
178
195
|
|
|
179
196
|
findLabelByReference(reference, context) { return this.context.findLabelByReference(reference, context); }
|
|
@@ -229,7 +246,7 @@ class LocalContext {
|
|
|
229
246
|
|
|
230
247
|
findEquivalenceByTerm(term) { return this.equivalences.findEquivalenceByTerm(term); }
|
|
231
248
|
|
|
232
|
-
findMetavariable(metavariable
|
|
249
|
+
findMetavariable(metavariable) { return this.context.findMetavariable(metavariable); }
|
|
233
250
|
|
|
234
251
|
findLabelByMetavariable(metavariable) { return this.context.findLabelByMetavariable(metavariable); }
|
|
235
252
|
|
|
@@ -249,7 +266,7 @@ class LocalContext {
|
|
|
249
266
|
|
|
250
267
|
findAxiomLemmaTheoremOrConjectureByReference(reference) { return this.context.findAxiomLemmaTheoremOrConjectureByReference(reference); }
|
|
251
268
|
|
|
252
|
-
isMetavariablePresent(metavariable
|
|
269
|
+
isMetavariablePresent(metavariable) { return this.context.isMetavariablePresent(metavariable); }
|
|
253
270
|
|
|
254
271
|
isTypePresentByTypeName(typeName, includeRelease = true, includeDependencies = true) { return this.context.isTypePresentByTypeName(typeName, includeRelease, includeDependencies); }
|
|
255
272
|
|
|
@@ -341,45 +358,13 @@ class LocalContext {
|
|
|
341
358
|
return termAndPropertyRelationMatches;
|
|
342
359
|
}
|
|
343
360
|
|
|
344
|
-
nodeAsString(node, tokens
|
|
345
|
-
if (tokens === null) {
|
|
346
|
-
tokens = this.tokens;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const string = this.context.nodeAsString(node, tokens);
|
|
350
|
-
|
|
351
|
-
return string;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
nodesAsString(node, tokens = null) {
|
|
355
|
-
if (tokens === null) {
|
|
356
|
-
tokens = this.tokens;
|
|
357
|
-
}
|
|
361
|
+
nodeAsString(node, tokens) { return this.context.nodeAsString(node, tokens); }
|
|
358
362
|
|
|
359
|
-
|
|
363
|
+
nodesAsString(node, tokens) { return this.context.nodesAsString(node, tokens); }
|
|
360
364
|
|
|
361
|
-
|
|
362
|
-
}
|
|
365
|
+
nodeAsTokens(node, tokens) { return this.context.nodeAsTokens(node, tokens); }
|
|
363
366
|
|
|
364
|
-
|
|
365
|
-
if (tokens === null) {
|
|
366
|
-
tokens = this.tokens;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
tokens = this.context.nodeAsTokens(node, tokens); ///
|
|
370
|
-
|
|
371
|
-
return tokens;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
nodesAsTokens(node, tokens = null) {
|
|
375
|
-
if (tokens === null) {
|
|
376
|
-
tokens = this.tokens;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
tokens = this.context.nodesAsTokens(node, tokens); ///
|
|
380
|
-
|
|
381
|
-
return tokens;
|
|
382
|
-
}
|
|
367
|
+
nodesAsTokens(node, tokens) { return this.context.nodesAsTokens(node, tokens); }
|
|
383
368
|
|
|
384
369
|
tokensAsString(tokens) { return this.context.tokensAsString(tokens); }
|
|
385
370
|
|
|
@@ -393,23 +378,13 @@ class LocalContext {
|
|
|
393
378
|
|
|
394
379
|
error(message, node = null) { this.context.error(message, node); }
|
|
395
380
|
|
|
396
|
-
static
|
|
397
|
-
const
|
|
381
|
+
static fromNothing(context) {
|
|
382
|
+
const { Equivalences } = ontology,
|
|
398
383
|
variables = [],
|
|
399
384
|
judgements = [],
|
|
400
385
|
equivalences = Equivalences.fromNothing(),
|
|
401
386
|
stepsOrSubproofs = [],
|
|
402
|
-
localContext = new LocalContext(context,
|
|
403
|
-
|
|
404
|
-
return localContext;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
static fromContextAndTokens(context, tokens) {
|
|
408
|
-
const variables = [],
|
|
409
|
-
judgements = [],
|
|
410
|
-
equivalences = Equivalences.fromNothing(),
|
|
411
|
-
stepsOrSubproofs = [],
|
|
412
|
-
localContext = new LocalContext(context, tokens, variables, judgements, equivalences, stepsOrSubproofs);
|
|
387
|
+
localContext = new LocalContext(context, variables, judgements, equivalences, stepsOrSubproofs);
|
|
413
388
|
|
|
414
389
|
return localContext;
|
|
415
390
|
}
|
package/src/context/partial.js
CHANGED
|
@@ -4,15 +4,11 @@ import { BNFLexer } from "occam-lexers";
|
|
|
4
4
|
import { BNFParser } from "occam-parsers";
|
|
5
5
|
import { arrayUtilities } from "necessary";
|
|
6
6
|
|
|
7
|
-
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
|
|
9
7
|
const { first } = arrayUtilities;
|
|
10
8
|
|
|
11
9
|
const bnfLexer = BNFLexer.fromNothing(),
|
|
12
10
|
bnfParser = BNFParser.fromNothing();
|
|
13
11
|
|
|
14
|
-
const childNodeQuery = nodeQuery("/*/*!");
|
|
15
|
-
|
|
16
12
|
export default class PartialContext {
|
|
17
13
|
constructor(node, tokens) {
|
|
18
14
|
this.node = node;
|
|
@@ -29,25 +25,24 @@ export default class PartialContext {
|
|
|
29
25
|
|
|
30
26
|
static fromStringLexerAndParser(Class, string, lexer, parser) {
|
|
31
27
|
const { rule } = Class,
|
|
32
|
-
|
|
33
|
-
ruleName = rule.getName();
|
|
34
|
-
|
|
35
|
-
ruleMap[ruleName] = rule;
|
|
36
|
-
|
|
37
|
-
const startRule = rule, ///
|
|
28
|
+
startRule = rule, ///
|
|
38
29
|
content = `${string}
|
|
39
30
|
`;
|
|
40
31
|
|
|
41
32
|
let tokens = lexer.tokenise(content),
|
|
42
33
|
node = parser.parse(tokens, startRule);
|
|
43
34
|
|
|
44
|
-
|
|
35
|
+
node.someChildNode((childNode) => {
|
|
36
|
+
const childNodeNonTerminalNode = childNode.isNonTerminalNode();
|
|
45
37
|
|
|
46
|
-
|
|
38
|
+
if (childNodeNonTerminalNode) {
|
|
39
|
+
node = childNode; ///
|
|
47
40
|
|
|
48
|
-
|
|
41
|
+
tokens = tokensFromTokensAndNode(tokens, node); ///
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
})
|
|
51
46
|
|
|
52
47
|
const partialContext = new Class(node, tokens);
|
|
53
48
|
|