occam-verify-cli 0.0.697 → 0.0.700

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 (102) hide show
  1. package/lib/assignment/equality.js +7 -5
  2. package/lib/assignment/metavariable.js +62 -0
  3. package/lib/assignment/variable.js +7 -5
  4. package/lib/constructor.js +3 -10
  5. package/lib/context/file.js +37 -97
  6. package/lib/context/local.js +28 -22
  7. package/lib/context/localMeta.js +21 -21
  8. package/lib/context/release.js +2 -4
  9. package/lib/equality.js +15 -7
  10. package/lib/metaType.js +10 -10
  11. package/lib/metavariable.js +27 -31
  12. package/lib/mixins/context.js +107 -0
  13. package/lib/ruleNames.js +9 -1
  14. package/lib/substitution/metastatementForMetavariable.js +17 -10
  15. package/lib/substitution/statementForMetavariable.js +17 -10
  16. package/lib/substitution/termForVariable.js +17 -11
  17. package/lib/type.js +23 -27
  18. package/lib/utilities/node.js +3 -73
  19. package/lib/utilities/query.js +2 -16
  20. package/lib/utilities/tokens.js +1 -8
  21. package/lib/variable.js +43 -36
  22. package/lib/verifier/node/metastatement.js +2 -3
  23. package/lib/verifier/node/statementAsCombinator.js +1 -1
  24. package/lib/verifier/node.js +2 -2
  25. package/lib/verifier/nodes/metastatementForMetavariable.js +5 -5
  26. package/lib/verifier/nodes/statementForMetavariable.js +5 -5
  27. package/lib/verifier/nodes/termForVariable.js +6 -6
  28. package/lib/verifier/nodes.js +2 -2
  29. package/lib/verify/axiom.js +3 -8
  30. package/lib/verify/conclusion.js +2 -2
  31. package/lib/verify/conjecture.js +4 -9
  32. package/lib/verify/derivation.js +3 -8
  33. package/lib/verify/equality.js +11 -11
  34. package/lib/verify/file.js +2 -2
  35. package/lib/verify/lemma.js +4 -9
  36. package/lib/verify/metavariable.js +8 -6
  37. package/lib/verify/premises.js +28 -0
  38. package/lib/verify/rule.js +3 -8
  39. package/lib/verify/ruleDerivation.js +6 -8
  40. package/lib/verify/standaloneType.js +32 -0
  41. package/lib/verify/statement/unqualified.js +2 -2
  42. package/lib/verify/supposition.js +4 -7
  43. package/lib/verify/suppositions.js +37 -0
  44. package/lib/verify/term.js +3 -4
  45. package/lib/verify/termAndStandaloneType.js +39 -0
  46. package/lib/verify/termAsVariableAndStandaloneType.js +39 -0
  47. package/lib/verify/theorem.js +4 -9
  48. package/lib/verify/type.js +2 -2
  49. package/lib/verify/typeAssertion.js +59 -89
  50. package/lib/verify/variable.js +12 -10
  51. package/package.json +1 -1
  52. package/src/assignment/equality.js +13 -4
  53. package/src/assignment/metavariable.js +30 -0
  54. package/src/assignment/variable.js +15 -4
  55. package/src/constructor.js +2 -7
  56. package/src/context/file.js +50 -41
  57. package/src/context/local.js +40 -27
  58. package/src/context/localMeta.js +26 -22
  59. package/src/context/release.js +6 -9
  60. package/src/equality.js +12 -5
  61. package/src/metaType.js +10 -10
  62. package/src/metavariable.js +24 -22
  63. package/src/mixins/{file.js → context.js} +20 -2
  64. package/src/ruleNames.js +2 -0
  65. package/src/substitution/metastatementForMetavariable.js +13 -7
  66. package/src/substitution/statementForMetavariable.js +13 -7
  67. package/src/substitution/termForVariable.js +13 -9
  68. package/src/type.js +27 -39
  69. package/src/utilities/node.js +3 -81
  70. package/src/utilities/query.js +1 -19
  71. package/src/utilities/tokens.js +0 -8
  72. package/src/variable.js +48 -30
  73. package/src/verifier/node/metastatement.js +1 -3
  74. package/src/verifier/node/statementAsCombinator.js +1 -1
  75. package/src/verifier/nodes/metastatementForMetavariable.js +5 -7
  76. package/src/verifier/nodes/statementForMetavariable.js +5 -7
  77. package/src/verifier/nodes/termForVariable.js +6 -8
  78. package/src/verify/axiom.js +2 -8
  79. package/src/verify/conclusion.js +1 -1
  80. package/src/verify/conjecture.js +3 -9
  81. package/src/verify/derivation.js +2 -8
  82. package/src/verify/equality.js +10 -10
  83. package/src/verify/file.js +1 -1
  84. package/src/verify/lemma.js +3 -9
  85. package/src/verify/metavariable.js +10 -9
  86. package/src/verify/premises.js +17 -0
  87. package/src/verify/rule.js +2 -8
  88. package/src/verify/ruleDerivation.js +5 -7
  89. package/src/verify/standaloneType.js +34 -0
  90. package/src/verify/statement/unqualified.js +1 -1
  91. package/src/verify/supposition.js +2 -7
  92. package/src/verify/suppositions.js +29 -0
  93. package/src/verify/term.js +3 -6
  94. package/src/verify/termAndStandaloneType.js +37 -0
  95. package/src/verify/termAsVariableAndStandaloneType.js +38 -0
  96. package/src/verify/theorem.js +3 -9
  97. package/src/verify/type.js +1 -1
  98. package/src/verify/typeAssertion.js +79 -110
  99. package/src/verify/variable.js +13 -13
  100. package/lib/mixins/file.js +0 -83
  101. package/lib/mixins/logging.js +0 -39
  102. package/src/mixins/logging.js +0 -24
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import Variable from "../variable";
4
- import Equality from "../equality";
5
4
  import Collection from "../collection";
6
- import fileMixins from "../mixins/file";
7
- import loggingMixins from "../mixins/logging";
5
+ import contextMixins from "../mixins/context";
8
6
 
9
- import { last, filter } from "../utilities/array";
7
+ import { last } from "../utilities/array";
10
8
  import { mergeCollections, findCollectionByType, findCollectionByTerm, findCollectionByTerms } from "../utilities/collection";
11
9
 
12
10
  class LocalContext {
@@ -25,8 +23,8 @@ class LocalContext {
25
23
  let variables = this.context.getVariables();
26
24
 
27
25
  variables = [ ///
28
- ...variables,
29
- ...this.variables
26
+ ...this.variables,
27
+ ...variables
30
28
  ];
31
29
 
32
30
  return variables;
@@ -36,8 +34,8 @@ class LocalContext {
36
34
  let proofSteps = this.context.getProofSteps();
37
35
 
38
36
  proofSteps = [ ///
39
- ...proofSteps,
40
- ...this.proofSteps
37
+ ...this.proofSteps,
38
+ ...proofSteps
41
39
  ];
42
40
 
43
41
  return proofSteps;
@@ -69,15 +67,17 @@ class LocalContext {
69
67
  getMetavariables() { return this.context.getMetavariables(); }
70
68
 
71
69
  addEquality(equality) {
70
+ let equalityAdded;
71
+
72
72
  const equalityReflexive = equality.isReflexive();
73
73
 
74
74
  if (equalityReflexive) {
75
- ///
75
+ equalityAdded = true; ///
76
76
  } else {
77
77
  const leftTerm = equality.getLeftTerm(),
78
78
  rightTerm = equality.getRightTerm(),
79
- leftCollection = this.findCollectionByTerm(leftTerm),
80
- rightCollection = this.findCollectionByTerm(rightTerm);
79
+ leftCollection = findCollectionByTerm(this.collections, leftTerm),
80
+ rightCollection = findCollectionByTerm(this.collections, rightTerm);
81
81
 
82
82
  if (false) {
83
83
  ///
@@ -85,37 +85,51 @@ class LocalContext {
85
85
  const collection = Collection.fromEquality(equality);
86
86
 
87
87
  this.addCollection(collection);
88
+
89
+ equalityAdded = true;
88
90
  } else if ((leftCollection !== null) && (rightCollection === null)) {
89
91
  const term = rightTerm, ///
90
92
  collection = leftCollection; ///
91
93
 
92
94
  collection.addTerm(term);
95
+
96
+ equalityAdded = true;
93
97
  } else if ((leftCollection === null) && (rightCollection !== null)) {
94
98
  const term = leftTerm, ///
95
99
  collection = rightCollection; ///
96
100
 
97
101
  collection.addTerm(term);
102
+
103
+ equalityAdded = true;
98
104
  } else if ((leftCollection !== null) && (rightCollection !== null)) {
99
105
 
100
106
  debugger
101
107
 
102
108
  }
103
109
  }
110
+
111
+ return equalityAdded;
104
112
  }
105
113
 
106
114
  addVariable(variable) {
107
- const variableName = variable.getName();
115
+ let variableAdded = false;
108
116
 
109
- filter(this.variables, (variable) => {
110
- const name = variable.getName(),
111
- nameVariableName = (name === variableName);
117
+ const node = variable.getNode(),
118
+ variablePresent = this.variables.some((variable) => {
119
+ const nodeMatches = variable.matchNode(node);
112
120
 
113
- if (!nameVariableName) {
114
- return true;
115
- }
116
- });
121
+ if (nodeMatches) {
122
+ return true;
123
+ }
124
+ });
125
+
126
+ if (!variablePresent) {
127
+ this.variables.push(variable);
128
+
129
+ variableAdded = true;
130
+ }
117
131
 
118
- this.variables.push(variable);
132
+ return variableAdded;
119
133
  }
120
134
 
121
135
  addProofStep(proofStep) {
@@ -169,11 +183,11 @@ class LocalContext {
169
183
  return collection;
170
184
  }
171
185
 
172
- findVariableByVariableName(variableName) {
173
- const name = variableName, ///
186
+ findVariableByVariableNode(variableNode) {
187
+ const node = variableNode, ///
174
188
  variables = this.getVariables(),
175
189
  variable = variables.find((variable) => {
176
- const matches = variable.matchName(name);
190
+ const matches = variable.matchNode(node);
177
191
 
178
192
  if (matches) {
179
193
  return true;
@@ -183,8 +197,8 @@ class LocalContext {
183
197
  return variable;
184
198
  }
185
199
 
186
- isVariablePresentByVariableName(variableName) {
187
- const variable = this.findVariableByVariableName(variableName),
200
+ isVariablePresentByVariableNode(variableNode) {
201
+ const variable = this.findVariableByVariableNode(variableNode),
188
202
  variablePresent = (variable !== null);
189
203
 
190
204
  return variablePresent;
@@ -291,7 +305,6 @@ class LocalContext {
291
305
  }
292
306
  }
293
307
 
294
- Object.assign(LocalContext.prototype, fileMixins);
295
- Object.assign(LocalContext.prototype, loggingMixins);
308
+ Object.assign(LocalContext.prototype, contextMixins);
296
309
 
297
310
  export default LocalContext;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import fileMixins from "../mixins/file";
4
- import loggingMixins from "../mixins/logging";
3
+ import contextMixins from "../mixins/context";
5
4
 
6
- import { last, filter } from "../utilities/array";
5
+ import { last } from "../utilities/array";
7
6
 
8
7
  class LocalMetaContext {
9
8
  constructor(context, metavariables, metaproofSteps) {
@@ -20,8 +19,8 @@ class LocalMetaContext {
20
19
  let metavariables = this.context.getMetavariables();
21
20
 
22
21
  metavariables = [ ///
22
+ ...this.metavariables,
23
23
  ...metavariables,
24
- this.metavariables
25
24
  ]
26
25
 
27
26
  return metavariables;
@@ -31,8 +30,8 @@ class LocalMetaContext {
31
30
  let metaproofSteps = this.context.getMetaproofSteps();
32
31
 
33
32
  metaproofSteps = [ ///
34
- ...metaproofSteps,
35
- ...this.metaproofSteps
33
+ ...this.metaproofSteps,
34
+ ...metaproofSteps
36
35
  ];
37
36
 
38
37
  return metaproofSteps;
@@ -53,18 +52,24 @@ class LocalMetaContext {
53
52
  }
54
53
 
55
54
  addMetavariable(metavariable) {
56
- const metavariableName = metavariable.getName();
55
+ let metavariableAdded = false;
57
56
 
58
- filter(this.metavariables, (metavariable) => {
59
- const name = metavariable.getName(),
60
- nameMetavariableName = (name === metavariableName);
57
+ const node = metavariable.getName(),
58
+ metavariablePresent = this.metavariables.some((metavariable) => {
59
+ const nodeMatches = metavariable.matchNode(node);
61
60
 
62
- if (!nameMetavariableName) {
63
- return true;
64
- }
65
- });
61
+ if (nodeMatches) {
62
+ return true;
63
+ }
64
+ });
65
+
66
+ if (!metavariablePresent) {
67
+ this.metavariables.push(metavariable);
68
+
69
+ metavariableAdded = true;
70
+ }
66
71
 
67
- this.metavariables.push(metavariable);
72
+ return metavariableAdded;
68
73
  }
69
74
 
70
75
  addMetaproofStep(metaproofStep) {
@@ -93,11 +98,11 @@ class LocalMetaContext {
93
98
  return metastatementMatches;
94
99
  }
95
100
 
96
- findMetavariableByMetavariableName(metavariableName) {
97
- const name = metavariableName, ///
101
+ findMetavariableByMetavariableNode(metavariableNode) {
102
+ const node = metavariableNode, ///
98
103
  metavariables = this.getMetavariables(),
99
104
  metavariable = metavariables.find((metavariable) => {
100
- const matches = metavariable.matchName(name);
105
+ const matches = metavariable.matchNode(node);
101
106
 
102
107
  if (matches) {
103
108
  return true;
@@ -107,8 +112,8 @@ class LocalMetaContext {
107
112
  return metavariable;
108
113
  }
109
114
 
110
- isMetavariablePresentByMetavariableName(metavariableName) {
111
- const metavariable = this.findMetavariableByMetavariableName(metavariableName),
115
+ isMetavariablePresentByMetavariableNode(metavariableNode) {
116
+ const metavariable = this.findMetavariableByMetavariableNode(metavariableNode),
112
117
  metavariablePresent = (metavariable !== null);
113
118
 
114
119
  return metavariablePresent;
@@ -134,7 +139,6 @@ class LocalMetaContext {
134
139
  }
135
140
  }
136
141
 
137
- Object.assign(LocalMetaContext.prototype, fileMixins);
138
- Object.assign(LocalMetaContext.prototype, loggingMixins);
142
+ Object.assign(LocalMetaContext.prototype, contextMixins);
139
143
 
140
144
  export default LocalMetaContext;
@@ -277,18 +277,15 @@ export default class ReleaseContext {
277
277
  findTypeByTypeName(typeName) {
278
278
  let types = this.getTypes();
279
279
 
280
- types = [ ///
281
- ...types,
282
- objectType
283
- ];
280
+ types.push(objectType);
284
281
 
285
282
  const type = types.find((type) => {
286
- const matches = type.matchTypeName(typeName);
283
+ const matches = type.matchTypeName(typeName);
287
284
 
288
- if (matches) {
289
- return true;
290
- }
291
- }) || null;
285
+ if (matches) {
286
+ return true;
287
+ }
288
+ }) || null;
292
289
 
293
290
  return type;
294
291
  }
package/src/equality.js CHANGED
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  export default class Equality {
4
- constructor(leftTerm, rightTerm) {
4
+ constructor(node, leftTerm, rightTerm) {
5
+ this.node = node;
5
6
  this.leftTerm = leftTerm;
6
7
  this.rightTerm = rightTerm;
7
8
  }
8
9
 
10
+ getNode() {
11
+ return this.node;
12
+ }
13
+
9
14
  getLeftTerm() {
10
15
  return this.leftTerm;
11
16
  }
@@ -21,15 +26,17 @@ export default class Equality {
21
26
  return reflexive;
22
27
  }
23
28
 
24
- static fromLeftTermAndRightTerm(leftTerm, rightTerm) {
29
+ static fromEqualityNodeLeftTermAndRightTerm(equalityNode, leftTerm, rightTerm) {
25
30
  let equality = null;
26
31
 
27
32
  const leftTermType = leftTerm.getType(),
28
33
  rightTermType = rightTerm.getType(),
29
- leftTermTypeEqualToSubTypeOfOrSuperTypeOfRightTermType = leftTermType.isEqualToSubTypeOfOrSuperTypeOf(rightTermType);
34
+ leftTermTypeComparableToRightTermType = leftTermType.isComparableTo(rightTermType);
35
+
36
+ if (leftTermTypeComparableToRightTermType) {
37
+ const node = equalityNode; ///
30
38
 
31
- if (leftTermTypeEqualToSubTypeOfOrSuperTypeOfRightTermType) {
32
- equality = new Equality(leftTerm, rightTerm);
39
+ equality = new Equality(node, leftTerm, rightTerm);
33
40
  }
34
41
 
35
42
  return equality;
package/src/metaType.js CHANGED
@@ -57,16 +57,6 @@ export default class MetaType {
57
57
 
58
58
  return metaType;
59
59
  }
60
-
61
- static fromJSONAndFileContext(json, fileContext) {
62
- let metaType;
63
-
64
- const { name } = json;
65
-
66
- metaType = new MetaType(name);
67
-
68
- return metaType;
69
- }
70
60
  }
71
61
 
72
62
  class StatementMetaType extends MetaType {
@@ -79,3 +69,13 @@ class StatementMetaType extends MetaType {
79
69
  }
80
70
 
81
71
  export const statementMetaType = StatementMetaType.fromNothing();
72
+
73
+ export function metaTypeFromJSONAndFileContext(json, fileContext) {
74
+ let metaType;
75
+
76
+ const { name } = json;
77
+
78
+ metaType = new MetaType(name);
79
+
80
+ return metaType;
81
+ }
@@ -1,33 +1,35 @@
1
1
  "use strict";
2
2
 
3
- import MetaType from "./metaType";
3
+ import { nodeAsString } from "./utilities/string";
4
+ import { metaTypeFromJSONAndFileContext } from "./metaType";
4
5
 
5
6
  export default class Metavariable {
6
- constructor(name, metaType) {
7
- this.name = name;
7
+ constructor(node, metaType) {
8
+ this.node = node;
8
9
  this.metaType = metaType;
9
10
  }
10
11
 
11
- getName() {
12
- return this.name;
12
+ getNode() {
13
+ return this.node;
13
14
  }
14
15
 
15
16
  getMetaType() {
16
17
  return this.metaType;
17
18
  }
18
19
 
19
- matchName(name) {
20
- const nameMatches = (this.name === name);
20
+ matchNode(node) {
21
+ const nodeMatches = this.node.match(node);
21
22
 
22
- return nameMatches;
23
+ return nodeMatches;
23
24
  }
24
25
 
25
26
  toJSON(tokens) {
26
27
  const metaTypeJSON = this.metaType.toJSON(tokens),
27
- name = this.name, ///
28
28
  metaType = metaTypeJSON, ///
29
+ string = nodeAsString(this.node, tokens),
30
+ node = string, ///
29
31
  json = {
30
- name,
32
+ node,
31
33
  metaType
32
34
  };
33
35
 
@@ -35,32 +37,32 @@ export default class Metavariable {
35
37
  }
36
38
 
37
39
  asString(tokens) {
38
- const metaTypeName = this.metaType.getName(),
39
- string = `${this.name}:${metaTypeName}`;
40
+ const metaTypeName = this.metaType.getName();
40
41
 
41
- return string;
42
- }
42
+ let string = nodeAsString(this.node, tokens);
43
43
 
44
- static fromNameAndMetaType(name, metaType) {
45
- const metavariable = new Metavariable(name, metaType);
44
+ string = `${string}:${metaTypeName}`;
46
45
 
47
- return metavariable;
46
+ return string;
48
47
  }
49
48
 
50
49
  static fromJSONAndFileContext(json, fileContext) {
51
- const { name } = json;
50
+ const { node } = json;
52
51
 
53
52
  let { metaType } = json;
54
53
 
55
54
  json = metaType; ///
56
55
 
57
- metaType = MetaType.fromJSONAndFileContext(json, fileContext);
56
+ metaType = metaTypeFromJSONAndFileContext(json, fileContext);
58
57
 
59
- const metaTypeName = metaType.getName();
58
+ const metavariable = new Metavariable(node, metaType);
60
59
 
61
- metaType = fileContext.findMetaTypeByMetaTypeName(metaTypeName); ///
60
+ return metavariable;
61
+ }
62
62
 
63
- const metavariable = new Metavariable(name, metaType);
63
+ static fromMetavariableNodeAndMetaType(metavariableNode, metaType) {
64
+ const node = metavariableNode, ///
65
+ metavariable = new Metavariable(node, metaType);
64
66
 
65
67
  return metavariable;
66
68
  }
@@ -1,5 +1,17 @@
1
1
  "use strict";
2
2
 
3
+ function trace(node, message) { this.context.trace(node, message); }
4
+
5
+ function debug(node, message) { this.context.debug(node, message); }
6
+
7
+ function info(node, message) { this.context.info(node, message); }
8
+
9
+ function warning(node, message) { this.context.warning(node, message); }
10
+
11
+ function error(node, message) { this.context.error(node, message); }
12
+
13
+ function fatal(node, message) { this.context.fatal(node, message); }
14
+
3
15
  function getAxioms() { return this.context.getAxioms(); }
4
16
 
5
17
  function getLemmas() { return this.context.getLemmas(); }
@@ -34,7 +46,13 @@ function nodeAsString(node) { return this.context.nodeAsString(node); }
34
46
 
35
47
  function nodesAsString(node) { return this.context.nodesAsString(node); }
36
48
 
37
- const fileMixins = {
49
+ const contextMixins = {
50
+ trace,
51
+ debug,
52
+ info,
53
+ warning,
54
+ error,
55
+ fatal,
38
56
  getAxioms,
39
57
  getLemmas,
40
58
  getTheorems,
@@ -54,4 +72,4 @@ const fileMixins = {
54
72
  nodesAsString
55
73
  };
56
74
 
57
- export default fileMixins;
75
+ export default contextMixins;
package/src/ruleNames.js CHANGED
@@ -13,7 +13,9 @@ export const METASTATEMENT_RULE_NAME = "metastatement";
13
13
  export const RULE_SUBPROOF_RULE_NAME = "ruleSubproof";
14
14
  export const META_ARGUMENT_RULE_NAME = "metaArgument";
15
15
  export const QUALIFIED_STATEMENT_RULE_NAME = "qualifiedStatement";
16
+ export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
16
17
  export const UNQUALIFIED_STATEMENT_RULE_NAME = "unqualifiedStatement";
17
18
  export const CONSTRUCTOR_DECLARATION_RULE_NAME = "constructorDeclaration";
18
19
  export const QUALIFIED_METASTATEMENT_RULE_NAME = "qualifiedMetastatement";
20
+ export const METAVARIABLE_DECLARATION_RULE_NAME = "metavariableDeclaration";
19
21
  export const UNQUALIFIED_METASTATEMENT_RULE_NAME = "unqualifiedMetastatement";
@@ -3,19 +3,25 @@
3
3
  import { bracketedMetastatementChildNodeFromMetastatementNode } from "../utilities/metaproof";
4
4
 
5
5
  export default class MetastatementForMetavariableSubstitution {
6
- constructor(metavariableName, metastatementNode) {
7
- this.metavariableName = metavariableName;
6
+ constructor(metavariableNode, metastatementNode) {
7
+ this.metavariableNode = metavariableNode;
8
8
  this.metastatementNode = metastatementNode;
9
9
  }
10
10
 
11
- getMetavariableName() {
12
- return this.metavariableName;
11
+ getMetavariableNode() {
12
+ return this.metavariableNode;
13
13
  }
14
14
 
15
15
  getMetastatementNode() {
16
16
  return this.metastatementNode;
17
17
  }
18
18
 
19
+ matchMetavariableNode(metavariableNode) {
20
+ const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
21
+
22
+ return metavariableNodeMatches;
23
+ }
24
+
19
25
  matchMetastatementNode(metastatementNode) {
20
26
  let metastatementNodeMatches;
21
27
 
@@ -34,15 +40,15 @@ export default class MetastatementForMetavariableSubstitution {
34
40
  return metastatementNodeMatches;
35
41
  }
36
42
 
37
- static fromMetavariableNameAndMetastatementNode(metavariableName, metastatementNode) {
38
- let metastatementForMetavariableSubstitution = new MetastatementForMetavariableSubstitution(metavariableName, metastatementNode);
43
+ static fromMetavariableNodeAndMetastatementNode(metavariableNode, metastatementNode) {
44
+ let metastatementForMetavariableSubstitution = new MetastatementForMetavariableSubstitution(metavariableNode, metastatementNode);
39
45
 
40
46
  const bracketedMetastatementChildNode = bracketedMetastatementChildNodeFromMetastatementNode(metastatementNode);
41
47
 
42
48
  if (bracketedMetastatementChildNode !== null) {
43
49
  const metastatementNode = bracketedMetastatementChildNode; ///
44
50
 
45
- metastatementForMetavariableSubstitution = new MetastatementForMetavariableSubstitution(metavariableName, metastatementNode);
51
+ metastatementForMetavariableSubstitution = new MetastatementForMetavariableSubstitution(metavariableNode, metastatementNode);
46
52
  }
47
53
 
48
54
  return metastatementForMetavariableSubstitution;
@@ -3,13 +3,13 @@
3
3
  import { bracketedStatementChildNodeFromStatementNode } from "../utilities/proof";
4
4
 
5
5
  export default class StatementForMetavariableSubstitution {
6
- constructor(metavariableName, statementNode) {
7
- this.metavariableName = metavariableName;
6
+ constructor(metavariableNode, statementNode) {
7
+ this.metavariableNode = metavariableNode;
8
8
  this.statementNode = statementNode;
9
9
  }
10
10
 
11
- getMetavariableName() {
12
- return this.metavariableName;
11
+ getMetavariableNode() {
12
+ return this.metavariableNode;
13
13
  }
14
14
 
15
15
  getStatementNode() {
@@ -34,15 +34,21 @@ export default class StatementForMetavariableSubstitution {
34
34
  return statementNodeMatches;
35
35
  }
36
36
 
37
- static fromMetavariableNameAndStatementNode(metavariableName, statementNode) {
38
- let statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(metavariableName, statementNode);
37
+ matchMetavariableNode(metavariableNode) {
38
+ const metavariableNodeMatches = this.metavariableNode.match(metavariableNode);
39
+
40
+ return metavariableNodeMatches;
41
+ }
42
+
43
+ static fromMetavariableNodeAndStatementNode(metavariableNode, statementNode) {
44
+ let statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(metavariableNode, statementNode);
39
45
 
40
46
  const bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
41
47
 
42
48
  if (bracketedStatementChildNode !== null) {
43
49
  const statementNode = bracketedStatementChildNode; ///
44
50
 
45
- statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(metavariableName, statementNode);
51
+ statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(metavariableNode, statementNode);
46
52
  }
47
53
 
48
54
  return statementForMetavariableSubstitution;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  export default class TermForVariableSubstitution {
4
- constructor(variableName, termNode) {
5
- this.variableName = variableName;
4
+ constructor(variableNode, termNode) {
5
+ this.variableNode = variableNode;
6
6
  this.termNode = termNode;
7
7
  }
8
8
 
9
- getVariableName() {
10
- return this.variableName;
9
+ getVariableNode() {
10
+ return this.variableNode;
11
11
  }
12
12
 
13
13
  getTermNode() {
@@ -15,15 +15,19 @@ export default class TermForVariableSubstitution {
15
15
  }
16
16
 
17
17
  matchTermNode(termNode) {
18
- let termNodeMatches;
19
-
20
- termNodeMatches = this.termNode.match(termNode);
18
+ const termNodeMatches = this.termNode.match(termNode);
21
19
 
22
20
  return termNodeMatches;
23
21
  }
24
22
 
25
- static fromVariableNameAndTermNode(variableName, termNode) {
26
- const termForVariableSubstitution = new TermForVariableSubstitution(variableName, termNode);
23
+ matchVariableNode(variableNode) {
24
+ const variableNodeMatches = this.variableNode.match(variableNode);
25
+
26
+ return variableNodeMatches;
27
+ }
28
+
29
+ static fromVariableNodeAndTermNode(variableNode, termNode) {
30
+ const termForVariableSubstitution = new TermForVariableSubstitution(variableNode, termNode);
27
31
 
28
32
  return termForVariableSubstitution;
29
33
  }