occam-verify-cli 0.0.1089 → 0.0.1091

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.
Files changed (126) hide show
  1. package/bin/action/verify.js +2 -2
  2. package/lib/assertion/contained.js +35 -41
  3. package/lib/assertion/defined.js +24 -24
  4. package/lib/assertion/subproof.js +24 -24
  5. package/lib/assertion/type.js +23 -23
  6. package/lib/assignment/equality.js +4 -10
  7. package/lib/assignment/judgement.js +4 -4
  8. package/lib/assignment/variable.js +4 -4
  9. package/lib/combinator/bracketed.js +3 -3
  10. package/lib/conclusion.js +11 -13
  11. package/lib/consequent.js +11 -13
  12. package/lib/constructor/bracketed.js +3 -3
  13. package/lib/constructor.js +2 -2
  14. package/lib/context/file.js +28 -27
  15. package/lib/context/local.js +31 -32
  16. package/lib/context/release.js +6 -3
  17. package/lib/declaration.js +18 -18
  18. package/lib/derivation.js +3 -3
  19. package/lib/equality.js +24 -24
  20. package/lib/equivalence.js +13 -13
  21. package/lib/frame.js +43 -43
  22. package/lib/index.js +2 -1
  23. package/lib/judgement.js +20 -20
  24. package/lib/label.js +9 -1
  25. package/lib/metaType.js +2 -2
  26. package/lib/metavariable.js +40 -39
  27. package/lib/mixins/statement/qualified/unify.js +19 -19
  28. package/lib/mixins/statement/resolve.js +11 -11
  29. package/lib/mixins/statement/unify.js +12 -12
  30. package/lib/mixins/statement/verify.js +36 -36
  31. package/lib/mixins/term/verify.js +2 -2
  32. package/lib/premise.js +31 -40
  33. package/lib/proof.js +6 -5
  34. package/lib/proofStep.js +17 -17
  35. package/lib/reference.js +8 -8
  36. package/lib/rule.js +21 -21
  37. package/lib/statement/qualified.js +17 -17
  38. package/lib/statement/unqualified.js +19 -19
  39. package/lib/statement.js +52 -54
  40. package/lib/subDerivation.js +3 -3
  41. package/lib/subproof.js +6 -5
  42. package/lib/substitution/frameForMetavariable.js +16 -39
  43. package/lib/substitution/statementForMetavariable.js +88 -74
  44. package/lib/substitution/termForVariable.js +15 -41
  45. package/lib/substitution.js +20 -6
  46. package/lib/substitutions.js +13 -13
  47. package/lib/supposition.js +31 -40
  48. package/lib/term.js +28 -28
  49. package/lib/topLevelAssertion.js +33 -21
  50. package/lib/unifier/equality.js +8 -8
  51. package/lib/unifier/intrinsicLevel.js +149 -0
  52. package/lib/unifier/metaLevel.js +41 -31
  53. package/lib/unifier/metavariable.js +14 -8
  54. package/lib/unifier/statementWithCombinator.js +16 -16
  55. package/lib/unifier/termWithConstructor.js +6 -6
  56. package/lib/unifier.js +47 -47
  57. package/lib/utilities/assignments.js +3 -3
  58. package/lib/utilities/equivalences.js +14 -14
  59. package/lib/utilities/json.js +22 -21
  60. package/lib/utilities/unifier.js +7 -8
  61. package/lib/variable.js +33 -33
  62. package/lib/verifier/statementAsCombinator.js +2 -2
  63. package/lib/verifier/termAsConstructor.js +2 -2
  64. package/package.json +2 -2
  65. package/src/assertion/contained.js +37 -45
  66. package/src/assertion/defined.js +25 -25
  67. package/src/assertion/subproof.js +25 -28
  68. package/src/assertion/type.js +23 -23
  69. package/src/assignment/equality.js +4 -6
  70. package/src/assignment/judgement.js +4 -4
  71. package/src/assignment/variable.js +4 -4
  72. package/src/combinator/bracketed.js +2 -2
  73. package/src/conclusion.js +14 -15
  74. package/src/consequent.js +14 -15
  75. package/src/constructor/bracketed.js +2 -2
  76. package/src/constructor.js +3 -2
  77. package/src/context/file.js +26 -25
  78. package/src/context/local.js +21 -23
  79. package/src/context/release.js +5 -3
  80. package/src/declaration.js +20 -20
  81. package/src/derivation.js +2 -2
  82. package/src/equality.js +26 -26
  83. package/src/equivalence.js +12 -12
  84. package/src/frame.js +42 -42
  85. package/src/index.js +1 -0
  86. package/src/judgement.js +25 -25
  87. package/src/label.js +14 -0
  88. package/src/metaType.js +1 -1
  89. package/src/metavariable.js +51 -43
  90. package/src/mixins/statement/qualified/unify.js +21 -21
  91. package/src/mixins/statement/resolve.js +12 -12
  92. package/src/mixins/statement/unify.js +11 -11
  93. package/src/mixins/statement/verify.js +35 -35
  94. package/src/mixins/term/verify.js +1 -1
  95. package/src/premise.js +42 -53
  96. package/src/proof.js +6 -4
  97. package/src/proofStep.js +21 -21
  98. package/src/reference.js +12 -11
  99. package/src/rule.js +20 -20
  100. package/src/statement/qualified.js +18 -17
  101. package/src/statement/unqualified.js +19 -18
  102. package/src/statement.js +63 -66
  103. package/src/subDerivation.js +2 -3
  104. package/src/subproof.js +6 -4
  105. package/src/substitution/frameForMetavariable.js +29 -45
  106. package/src/substitution/statementForMetavariable.js +136 -86
  107. package/src/substitution/termForVariable.js +28 -49
  108. package/src/substitution.js +15 -5
  109. package/src/substitutions.js +12 -12
  110. package/src/supposition.js +41 -53
  111. package/src/term.js +27 -27
  112. package/src/topLevelAssertion.js +32 -19
  113. package/src/unifier/equality.js +7 -7
  114. package/src/unifier/intrinsicLevel.js +61 -0
  115. package/src/unifier/metaLevel.js +60 -46
  116. package/src/unifier/metavariable.js +22 -13
  117. package/src/unifier/statementWithCombinator.js +28 -28
  118. package/src/unifier/termWithConstructor.js +8 -8
  119. package/src/unifier.js +55 -55
  120. package/src/utilities/assignments.js +2 -2
  121. package/src/utilities/equivalences.js +13 -13
  122. package/src/utilities/json.js +76 -66
  123. package/src/utilities/unifier.js +10 -12
  124. package/src/variable.js +43 -40
  125. package/src/verifier/statementAsCombinator.js +2 -1
  126. package/src/verifier/termAsConstructor.js +2 -1
@@ -3,7 +3,7 @@
3
3
  import BracketedCombinator from "../../combinator/bracketed";
4
4
  import statementWithCombinatorUnifier from "../../unifier/statementWithCombinator";
5
5
 
6
- function unifyWithBracketedCombinator(statement, assignments, stated, localContext) {
6
+ function unifyWithBracketedCombinator(statement, assignments, stated, context) {
7
7
  let unifiedWithBracketedCombinator;
8
8
 
9
9
  const statementNode = statement.getNode(),
@@ -12,28 +12,28 @@ function unifyWithBracketedCombinator(statement, assignments, stated, localConte
12
12
  bracketedCombinatorStatementNode = bracketedCombinator.getStatementNode(),
13
13
  combinatorStatementNode = bracketedCombinatorStatementNode; ///
14
14
 
15
- localContext.trace(`Unifying the '${statementString}' statement with the bracketed combinator...`);
15
+ context.trace(`Unifying the '${statementString}' statement with the bracketed combinator...`);
16
16
 
17
- unifiedWithBracketedCombinator = statementWithCombinatorUnifier.unify(combinatorStatementNode, statementNode, assignments, stated, localContext);
17
+ unifiedWithBracketedCombinator = statementWithCombinatorUnifier.unify(combinatorStatementNode, statementNode, assignments, stated, context);
18
18
 
19
19
  if (unifiedWithBracketedCombinator) {
20
- localContext.debug(`...unified the '${statementString}' statement with the bracketed combinator.`);
20
+ context.debug(`...unified the '${statementString}' statement with the bracketed combinator.`);
21
21
  }
22
22
 
23
23
  return unifiedWithBracketedCombinator;
24
24
  }
25
25
 
26
- function unifyWithCombinators(statement, assignments, stated, localContext) {
26
+ function unifyWithCombinators(statement, assignments, stated, context) {
27
27
  let unifiedWithCombinators;
28
28
 
29
- const combinators = localContext.getCombinators();
29
+ const combinators = context.getCombinators();
30
30
 
31
31
  stated = true; ///
32
32
 
33
33
  assignments = null; ///
34
34
 
35
35
  unifiedWithCombinators = combinators.some((combinator) => {
36
- const unifiedWithCombinator = unifyStatementWithCombinator(statement, combinator, assignments, stated, localContext);
36
+ const unifiedWithCombinator = unifyStatementWithCombinator(statement, combinator, assignments, stated, context);
37
37
 
38
38
  if (unifiedWithCombinator) {
39
39
  return true;
@@ -51,7 +51,7 @@ const unifyMixins = [
51
51
 
52
52
  export default unifyMixins;
53
53
 
54
- function unifyStatementWithCombinator(statement, combinator, assignments, stated, localContext) {
54
+ function unifyStatementWithCombinator(statement, combinator, assignments, stated, context) {
55
55
  let unifiedWithCombinator;
56
56
 
57
57
  const statementNode = statement.getNode(),
@@ -59,12 +59,12 @@ function unifyStatementWithCombinator(statement, combinator, assignments, stated
59
59
  combinatorString = combinator.getString(),
60
60
  combinatorStatementNode = combinator.getStatementNode();
61
61
 
62
- localContext.trace(`Unifying the '${statementString}' statement with the '${combinatorString}' combinator...`);
62
+ context.trace(`Unifying the '${statementString}' statement with the '${combinatorString}' combinator...`);
63
63
 
64
- unifiedWithCombinator = statementWithCombinatorUnifier.unify(combinatorStatementNode, statementNode, assignments, stated, localContext);
64
+ unifiedWithCombinator = statementWithCombinatorUnifier.unify(combinatorStatementNode, statementNode, assignments, stated, context);
65
65
 
66
66
  if (unifiedWithCombinator) {
67
- localContext.debug(`...unified the '${statementString}' statement with the '${combinatorString}' combinator.`);
67
+ context.debug(`...unified the '${statementString}' statement with the '${combinatorString}' combinator.`);
68
68
  }
69
69
 
70
70
  return unifiedWithCombinator;
@@ -16,171 +16,171 @@ const equalityNodeQuery = nodeQuery("/statement/equality"),
16
16
  subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion"),
17
17
  containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion");
18
18
 
19
- function verifyAsMetavariable(statement, assignments, stated, localContext) {
19
+ function verifyAsMetavariable(statement, assignments, stated, context) {
20
20
  let verifiedAsMetavariable = false;
21
21
 
22
22
  const { Metavariable } = shim,
23
23
  statementNode = statement.getNode(),
24
24
  metavariableNode = metavariableNodeQuery(statementNode),
25
- metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext);
25
+ metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
26
26
 
27
27
  if (metavariable !== null) {
28
28
  const statementString = statement.getString();
29
29
 
30
- localContext.trace(`Verifying the '${statementString}' statement as a metavariable...`);
30
+ context.trace(`Verifying the '${statementString}' statement as a metavariable...`);
31
31
 
32
- const metavariableVerified = metavariable.verify(localContext);
32
+ const metavariableVerified = metavariable.verify(context);
33
33
 
34
34
  verifiedAsMetavariable = metavariableVerified; ///
35
35
 
36
36
  if (verifiedAsMetavariable) {
37
- localContext.debug(`...verified the '${statementString}' statement as a metavariable.`);
37
+ context.debug(`...verified the '${statementString}' statement as a metavariable.`);
38
38
  }
39
39
  }
40
40
 
41
41
  return verifiedAsMetavariable;
42
42
  }
43
43
 
44
- function verifyAsEquality(statement, assignments, stated, localContext) {
44
+ function verifyAsEquality(statement, assignments, stated, context) {
45
45
  let verifiedAsEquality = false;
46
46
 
47
47
  const { Equality } = shim,
48
48
  statementNode = statement.getNode(),
49
49
  equalityNode = equalityNodeQuery(statementNode),
50
- equality = Equality.fromEqualityNode(equalityNode, localContext);
50
+ equality = Equality.fromEqualityNode(equalityNode, context);
51
51
 
52
52
  if (equality !== null) {
53
53
  const statementString = statement.getString();
54
54
 
55
- localContext.trace(`Verifying the '${statementString}' statement as an equality...`);
55
+ context.trace(`Verifying the '${statementString}' statement as an equality...`);
56
56
 
57
- const equalityVerified = equality.verify(assignments, stated, localContext);
57
+ const equalityVerified = equality.verify(assignments, stated, context);
58
58
 
59
59
  verifiedAsEquality = equalityVerified; ///
60
60
 
61
61
  if (verifiedAsEquality) {
62
- localContext.debug(`...verified the '${statementString}' statement as an equality.`);
62
+ context.debug(`...verified the '${statementString}' statement as an equality.`);
63
63
  }
64
64
  }
65
65
 
66
66
  return verifiedAsEquality;
67
67
  }
68
68
 
69
- function verifyAsJudgement(statement, assignments, stated, localContext) {
69
+ function verifyAsJudgement(statement, assignments, stated, context) {
70
70
  let verifiedAsJudgement = false;
71
71
 
72
72
  const { Judgement } = shim,
73
73
  statementNode = statement.getNode(),
74
74
  judgementNode = judgementNodeQuery(statementNode),
75
- judgement = Judgement.fromJudgementNode(judgementNode, localContext);
75
+ judgement = Judgement.fromJudgementNode(judgementNode, context);
76
76
 
77
77
  if (judgement !== null) {
78
78
  const statementString = statement.getString();
79
79
 
80
- localContext.trace(`Verifying the '${statementString}' statement as a judgement...`);
80
+ context.trace(`Verifying the '${statementString}' statement as a judgement...`);
81
81
 
82
- const judgementVerified = judgement.verify(assignments, stated, localContext);
82
+ const judgementVerified = judgement.verify(assignments, stated, context);
83
83
 
84
84
  verifiedAsJudgement = judgementVerified; ///
85
85
 
86
86
  if (verifiedAsJudgement) {
87
- localContext.debug(`...verified the '${statementString}' statement as a judgement.`);
87
+ context.debug(`...verified the '${statementString}' statement as a judgement.`);
88
88
  }
89
89
  }
90
90
 
91
91
  return verifiedAsJudgement;
92
92
  }
93
93
 
94
- function verifyAsTypeAssertion(statement, assignments, stated, localContext) {
94
+ function verifyAsTypeAssertion(statement, assignments, stated, context) {
95
95
  let verifiedAsTypeAssertion = false;
96
96
 
97
97
  const statementNode = statement.getNode(),
98
98
  typeAssertionNode = typeAssertionNodeQuery(statementNode),
99
- typeAssertion = TypeAssertion.fromTypeAssertionNode(typeAssertionNode, localContext);
99
+ typeAssertion = TypeAssertion.fromTypeAssertionNode(typeAssertionNode, context);
100
100
 
101
101
  if (typeAssertion !== null) {
102
102
  const statementString = statement.getString();
103
103
 
104
- localContext.trace(`Verifying the '${statementString}' statement as a type assertion...`);
104
+ context.trace(`Verifying the '${statementString}' statement as a type assertion...`);
105
105
 
106
- const typeAssertionVerified = typeAssertion.verify(assignments, stated, localContext);
106
+ const typeAssertionVerified = typeAssertion.verify(assignments, stated, context);
107
107
 
108
108
  verifiedAsTypeAssertion = typeAssertionVerified; ///
109
109
 
110
110
  if (verifiedAsTypeAssertion) {
111
- localContext.debug(`...verified the '${statementString}' statement as a type assertion.`);
111
+ context.debug(`...verified the '${statementString}' statement as a type assertion.`);
112
112
  }
113
113
  }
114
114
 
115
115
  return verifiedAsTypeAssertion;
116
116
  }
117
117
 
118
- function verifyAsDefinedAssertion(statement, assignments, stated, localContext) {
118
+ function verifyAsDefinedAssertion(statement, assignments, stated, context) {
119
119
  let verifiedAsDefinedAssertion = false;
120
120
 
121
121
  const statementNode = statement.getNode(),
122
122
  definedAssertionNode = definedAssertionNodeQuery(statementNode),
123
- definedAssertion = DefinedAssertion.fromDefinedAssertionNode(definedAssertionNode, localContext);
123
+ definedAssertion = DefinedAssertion.fromDefinedAssertionNode(definedAssertionNode, context);
124
124
 
125
125
  if (definedAssertion !== null) {
126
126
  const statementString = statement.getString();
127
127
 
128
- localContext.trace(`Verifying the '${statementString}' statement as a defined assertion...`);
128
+ context.trace(`Verifying the '${statementString}' statement as a defined assertion...`);
129
129
 
130
- const definedAssertionVerified = definedAssertion.verify(assignments, stated, localContext);
130
+ const definedAssertionVerified = definedAssertion.verify(assignments, stated, context);
131
131
 
132
132
  verifiedAsDefinedAssertion = definedAssertionVerified; ///
133
133
 
134
134
  if (verifiedAsDefinedAssertion) {
135
- localContext.debug(`...verified the '${statementString}' statement as a defined assertion.`);
135
+ context.debug(`...verified the '${statementString}' statement as a defined assertion.`);
136
136
  }
137
137
  }
138
138
 
139
139
  return verifiedAsDefinedAssertion;
140
140
  }
141
141
 
142
- function verifyAsContainedAssertion(statement, assignments, stated, localContext) {
142
+ function verifyAsContainedAssertion(statement, assignments, stated, context) {
143
143
  let verifiedAsContainedAssertion = false;
144
144
 
145
145
  const statementNode = statement.getNode(),
146
146
  containedAssertionNode = containedAssertionNodeQuery(statementNode),
147
- containedAssertion = ContainedAssertion.fromContainedAssertionNode(containedAssertionNode, localContext);
147
+ containedAssertion = ContainedAssertion.fromContainedAssertionNode(containedAssertionNode, context);
148
148
 
149
149
  if (containedAssertion !== null) {
150
150
  const statementString = statement.getString();
151
151
 
152
- localContext.trace(`Verifying the '${statementString}' statement as a contained assertion...`);
152
+ context.trace(`Verifying the '${statementString}' statement as a contained assertion...`);
153
153
 
154
- const containedAssertionVerified = containedAssertion.verify(assignments, stated, localContext);
154
+ const containedAssertionVerified = containedAssertion.verify(assignments, stated, context);
155
155
 
156
156
  verifiedAsContainedAssertion = containedAssertionVerified; ///
157
157
 
158
158
  if (verifiedAsContainedAssertion) {
159
- localContext.debug(`...verified the '${statementString}' statement as a contained assertion.`);
159
+ context.debug(`...verified the '${statementString}' statement as a contained assertion.`);
160
160
  }
161
161
  }
162
162
 
163
163
  return verifiedAsContainedAssertion;
164
164
  }
165
165
 
166
- function verifyAsSubproofAssertion(statement, assignments, stated, localContext) {
166
+ function verifyAsSubproofAssertion(statement, assignments, stated, context) {
167
167
  let verifiedAsSubproofAssertion = false;
168
168
 
169
169
  const statementNode = statement.getNode(),
170
170
  subproofAssertionNode = subproofAssertionNodeQuery(statementNode),
171
- subproofAssertion = SubproofAssertion.fromSubproofAssertionNode(subproofAssertionNode, localContext);
171
+ subproofAssertion = SubproofAssertion.fromSubproofAssertionNode(subproofAssertionNode, context);
172
172
 
173
173
  if (subproofAssertionNode !== null) {
174
174
  const statementString = statement.getString();
175
175
 
176
- localContext.trace(`Verifying the '${statementString}' statement as a subproof assertion...`);
176
+ context.trace(`Verifying the '${statementString}' statement as a subproof assertion...`);
177
177
 
178
- const subproofAssertionVerified = subproofAssertion.verify(assignments, stated, localContext);
178
+ const subproofAssertionVerified = subproofAssertion.verify(assignments, stated, context);
179
179
 
180
180
  verifiedAsSubproofAssertion = subproofAssertionVerified; ///
181
181
 
182
182
  if (verifiedAsSubproofAssertion) {
183
- localContext.debug(`...verified the '${statementString}' statement as a subproof assertion.`);
183
+ context.debug(`...verified the '${statementString}' statement as a subproof assertion.`);
184
184
  }
185
185
  }
186
186
 
@@ -15,7 +15,7 @@ function verifyTermAsVariable(term, localContext, verifyAhead) {
15
15
  variable = Variable.fromVariableNode(variableNode, localContext);
16
16
 
17
17
  if (variable !== null) {
18
- const termString = localContext.nodeAsString(termNode);
18
+ const termString = term.getString();
19
19
 
20
20
  localContext.trace(`Verifying the '${termString}' term as a variable...`);
21
21
 
package/src/premise.js CHANGED
@@ -7,6 +7,7 @@ import SubproofAssertion from "./assertion/subproof";
7
7
  import { nodeQuery } from "./utilities/query";
8
8
  import { assignAssignments } from "./utilities/assignments";
9
9
  import { unqualifiedStatementFromJSON, unqualifiedStatementToUnqualifiedStatementJSON } from "./utilities/json";
10
+ import local from "./context/local";
10
11
 
11
12
  const unqualifiedStatementNodeQuery = nodeQuery("/premise/unqualifiedStatement");
12
13
 
@@ -28,33 +29,36 @@ class Premise {
28
29
 
29
30
  getStatement() { return this.unqualifiedStatement.getStatement(); }
30
31
 
31
- resolveIndependently(substitutions, localContext) {
32
+ resolveIndependently(substitutions, context) {
32
33
  let resolvedIndependently;
33
34
 
34
- const premiseString = this.getString();
35
+ const localContext = LocalContext.fromFileContext(this.fileContext),
36
+ generalContext = localContext, ///
37
+ specificContext = context; ///
35
38
 
36
- const localContextB = localContext; ///
37
-
38
- localContext = LocalContext.fromFileContext(this.fileContext);
39
-
40
- const localContextA = localContext; ///
39
+ const premise = this, ///
40
+ premiseString = premise.getString();
41
41
 
42
- localContextB.trace(`Resolving the '${premiseString}' premise independently...`);
42
+ specificContext.trace(`Resolving the '${premiseString}' premise independently...`);
43
43
 
44
- const unqualifiedStatementResolvedIndependently = this.unqualifiedStatement.resolveIndependently(substitutions, localContextA, localContextB);
44
+ const unqualifiedStatementResolvedIndependently = this.unqualifiedStatement.resolveIndependently(substitutions, generalContext, specificContext);
45
45
 
46
46
  resolvedIndependently = unqualifiedStatementResolvedIndependently; ///
47
47
 
48
48
  if (resolvedIndependently) {
49
- localContextB.trace(`...resolved the '${premiseString}' premise independently.`);
49
+ specificContext.trace(`...resolved the '${premiseString}' premise independently.`);
50
50
  }
51
51
 
52
52
  return resolvedIndependently;
53
53
  }
54
54
 
55
- unifyProofStep(proofStep, substitutions, localContext) {
55
+ unifyProofStep(proofStep, substitutions, context) {
56
56
  let proofStepUnified = false;
57
57
 
58
+ const localContext = LocalContext.fromFileContext(this.fileContext),
59
+ generalContext = localContext, ///
60
+ specificContext = context; ///
61
+
58
62
  const subproof = proofStep.getSubproof(),
59
63
  statement = proofStep.getStatement();
60
64
 
@@ -66,54 +70,47 @@ class Premise {
66
70
  if (false) {
67
71
  ///
68
72
  } else if (subproof !== null) {
69
- subproofUnified = this.unifySubproof(subproof, substitutions, localContext);
73
+ subproofUnified = this.unifySubproof(subproof, substitutions, generalContext, specificContext);
70
74
  } else if (statement !== null) {
71
- statementUnified = this.unifyStatement(statement, substitutions, localContext);
75
+ statementUnified = this.unifyStatement(statement, substitutions, generalContext, specificContext);
72
76
  }
73
77
 
74
78
  if (subproofUnified || statementUnified) {
75
- const localContextB = localContext; ///
79
+ const localContext = LocalContext.fromFileContext(this.fileContext),
80
+ generalContext = localContext, ///
81
+ specificContext = context; ///
76
82
 
77
- localContext = LocalContext.fromFileContext(this.fileContext);
78
-
79
- const localContextA = localContext; ///
80
-
81
- substitutions.resolve(localContextA, localContextB);
83
+ substitutions.resolve(generalContext, specificContext);
82
84
 
83
85
  proofStepUnified = true;
84
86
  }
85
87
 
86
88
  proofStepUnified ?
87
89
  substitutions.continue() :
88
- substitutions.rollback(localContext);
90
+ substitutions.rollback(context);
89
91
 
90
92
  return proofStepUnified;
91
93
  }
92
94
 
93
- unifyStatement(statement, substitutions, localContext) {
95
+ unifyStatement(statement, substitutions, generalContext, specificContext) {
94
96
  let statementUnified;
95
97
 
96
- const statementString = statement.getString(),
97
- premiseString = this.getString();
98
-
99
- const localContextB = localContext; ///
100
-
101
- localContext = LocalContext.fromFileContext(this.fileContext);
102
-
103
- const localContextA = localContext; ///
98
+ const premise = this, ///
99
+ premiseString = premise.getString(),
100
+ statementString = statement.getString();
104
101
 
105
- localContextB.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`);
102
+ specificContext.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`);
106
103
 
107
- statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, localContextA, localContextB);
104
+ statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
108
105
 
109
106
  if (statementUnified) {
110
- localContextB.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`);
107
+ specificContext.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`);
111
108
  }
112
109
 
113
110
  return statementUnified;
114
111
  }
115
112
 
116
- unifySubproof(subproof, substitutions, localContext) {
113
+ unifySubproof(subproof, substitutions, generalContext, specificContext) {
117
114
  let subproofUnified = false;
118
115
 
119
116
  const premise = this, ///
@@ -121,59 +118,51 @@ class Premise {
121
118
  premiseStatement = premise.getStatement(),
122
119
  premiseStatementString = premiseStatement.getString();
123
120
 
124
- const localContextB = localContext; ///
125
-
126
121
  const statement = this.unqualifiedStatement.getStatement(),
127
- statementTokens = statement.getTokens(),
128
- context = this.fileContext, ///
129
- tokens = statementTokens; ///
130
-
131
- localContext = LocalContext.fromContextAndTokens(context, tokens); ///
132
-
133
- const localContextA = localContext; ///
122
+ statementNode = statement.getNode();
134
123
 
135
- localContextB.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
124
+ specificContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
136
125
 
137
- const statementNode = statement.getNode(),
138
- subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, localContext);
126
+ const context = specificContext, ///
127
+ subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, context);
139
128
 
140
129
  if (subproofAssertion !== null) {
141
- subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, localContextA, localContextB);
130
+ subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
142
131
  }
143
132
 
144
133
  if (subproofUnified) {
145
- localContextB.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement.`);
134
+ specificContext.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement.`);
146
135
  }
147
136
 
148
137
  return subproofUnified;
149
138
  }
150
139
 
151
- verify(localContext) {
140
+ verify(context) {
152
141
  let verified = false;
153
142
 
154
143
  const premiseString = this.getString(); ///
155
144
 
156
- localContext.trace(`Verifying the '${premiseString}' premise...`);
145
+ context.trace(`Verifying the '${premiseString}' premise...`);
157
146
 
158
147
  const stated = true,
159
148
  assignments = [],
160
- unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, localContext);
149
+ unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, context);
161
150
 
162
151
  if (unqualifiedStatementVerified) {
163
- const assignmentsAssigned = assignAssignments(assignments, localContext);
152
+ const assignmentsAssigned = assignAssignments(assignments, context);
164
153
 
165
154
  if (assignmentsAssigned) {
166
155
  const { ProofStep } = shim,
167
156
  proofStep = ProofStep.fromUnqualifiedStatement(this.unqualifiedStatement);
168
157
 
169
- localContext.addProofStep(proofStep);
158
+ context.addProofStep(proofStep);
170
159
 
171
160
  verified = true;
172
161
  }
173
162
  }
174
163
 
175
164
  if (verified) {
176
- localContext.debug(`...verified the '${premiseString}' premise.`);
165
+ context.debug(`...verified the '${premiseString}' premise.`);
177
166
  }
178
167
 
179
168
  return verified;
package/src/proof.js CHANGED
@@ -26,15 +26,17 @@ class Proof {
26
26
  return statement;
27
27
  }
28
28
 
29
- verify(substitutions, conclusion, localContext) {
29
+ verify(substitutions, conclusion, context) {
30
30
  let verified = false;
31
31
 
32
- localContext = LocalContext.fromLocalContext(localContext); ///
32
+ const localContext = LocalContext.fromContext(context); ///
33
33
 
34
- const derivationVerified = this.derivation.verify(substitutions, localContext);
34
+ context = localContext; ///
35
+
36
+ const derivationVerified = this.derivation.verify(substitutions, context);
35
37
 
36
38
  if (derivationVerified) {
37
- const lastProofStep = localContext.getLastProofStep();
39
+ const lastProofStep = context.getLastProofStep();
38
40
 
39
41
  if (lastProofStep !== null) {
40
42
  const statement = this.getStatement(),
package/src/proofStep.js CHANGED
@@ -47,25 +47,25 @@ class ProofStep {
47
47
  return statement;
48
48
  }
49
49
 
50
- unifyStatement(statement, localContext) {
50
+ unifyStatement(statement, context) {
51
51
  let statementUnified = false;
52
52
 
53
53
  if ((this.qualifiedStatement !== null) || (this.unqualifiedStatement !== null !== null)) {
54
54
  const statementString = statement.getString();
55
55
 
56
- localContext.trace(`Unifying the '${statementString}' statement...`);
56
+ context.trace(`Unifying the '${statementString}' statement...`);
57
57
 
58
58
  const { Substitutions } = shim,
59
- localContextA = localContext, ///
60
- localContextB = localContext, ///
59
+ specificContext = context, ///
60
+ generalContext = context, ///
61
61
  substitutions = Substitutions.fromNothing();
62
62
 
63
63
  if (this.qualifiedStatement !== null) {
64
- statementUnified = this.qualifiedStatement.unifyStatement(statement, substitutions, localContextA, localContextB);
64
+ statementUnified = this.qualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
65
65
  }
66
66
 
67
67
  if (this.unqualifiedStatement !== null) {
68
- statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, localContextA, localContextB);
68
+ statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
69
69
  }
70
70
 
71
71
  const substitutionsLength = substitutions.getLength();
@@ -75,21 +75,21 @@ class ProofStep {
75
75
  }
76
76
 
77
77
  if (statementUnified) {
78
- localContext.debug(`...unified the '${statementString}' statement.`);
78
+ context.debug(`...unified the '${statementString}' statement.`);
79
79
  }
80
80
  }
81
81
 
82
82
  return statementUnified;
83
83
  }
84
84
 
85
- unifySubproofAssertion(subproofAssertion, localContext) {
85
+ unifySubproofAssertion(subproofAssertion, context) {
86
86
  let subproofAssertionUnified = false;
87
87
 
88
88
  if (this.subproof !== null) {
89
89
  const subproofString = this.subproof.getString(),
90
90
  subproofAssertionString = subproofAssertion.getString();
91
91
 
92
- localContext.trace(`Unifying the '${subproofAssertionString}' subproof assertion with the '${subproofString}' subproof...`);
92
+ context.trace(`Unifying the '${subproofAssertionString}' subproof assertion with the '${subproofString}' subproof...`);
93
93
 
94
94
  const { Substitutions } = shim,
95
95
  substitutions = Substitutions.fromNothing(),
@@ -99,11 +99,11 @@ class ProofStep {
99
99
  subproofAssertionUnified = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
100
100
  const subproofAssertionStatementNode = subproofAssertionStatement.getNode(),
101
101
  subproofStatementNode = subproofStatement.getNode(),
102
- nodeA = subproofAssertionStatementNode, ///
103
- nodeB = subproofStatementNode, ///
104
- localContextA = localContext, ///
105
- localContextB = localContext, ///
106
- unifiedAtMetaLevel = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
102
+ generalNode = subproofAssertionStatementNode, ///
103
+ specificNode = subproofStatementNode, ///
104
+ generalContext = context, ///
105
+ specificContext = context, ///
106
+ unifiedAtMetaLevel = metaLevelUnifier.unify(generalNode, specificNode, substitutions, generalContext, specificContext);
107
107
 
108
108
  if (unifiedAtMetaLevel) {
109
109
  return true;
@@ -119,14 +119,14 @@ class ProofStep {
119
119
  }
120
120
 
121
121
  if (subproofAssertionUnified) {
122
- localContext.trace(`...unified the '${subproofAssertionString}' subproof assertion with the '${subproofString}' subproof.`);
122
+ context.trace(`...unified the '${subproofAssertionString}' subproof assertion with the '${subproofString}' subproof.`);
123
123
  }
124
124
  }
125
125
 
126
126
  return subproofAssertionUnified;
127
127
  }
128
128
 
129
- verify(substitutions, localContext) {
129
+ verify(substitutions, context) {
130
130
  let verified = false;
131
131
 
132
132
  let stated = false;
@@ -138,23 +138,23 @@ class ProofStep {
138
138
  unqualifiedStatementVerified = false;
139
139
 
140
140
  if (this.subproof !== null) {
141
- subproofVerified = this.subproof.verify(substitutions, localContext);
141
+ subproofVerified = this.subproof.verify(substitutions, context);
142
142
  }
143
143
 
144
144
  if (this.qualifiedStatement !== null) {
145
145
  stated = true;
146
146
 
147
- qualifiedStatementVerified = this.qualifiedStatement.verify(substitutions, assignments, stated, localContext);
147
+ qualifiedStatementVerified = this.qualifiedStatement.verify(substitutions, assignments, stated, context);
148
148
  }
149
149
 
150
150
  if (this.unqualifiedStatement !== null) {
151
151
  stated = false;
152
152
 
153
- unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, localContext);
153
+ unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, context);
154
154
  }
155
155
 
156
156
  if (subproofVerified || qualifiedStatementVerified || unqualifiedStatementVerified) {
157
- const assignmentsAssigned = assignAssignments(assignments, localContext);
157
+ const assignmentsAssigned = assignAssignments(assignments, context);
158
158
 
159
159
  if (assignmentsAssigned) {
160
160
  verified = true;
@@ -164,7 +164,7 @@ class ProofStep {
164
164
  if (verified) {
165
165
  const proofStep = this; ///
166
166
 
167
- localContext.addProofStep(proofStep);
167
+ context.addProofStep(proofStep);
168
168
  }
169
169
 
170
170
  return verified;