occam-verify-cli 0.0.959 → 0.0.961

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 (141) hide show
  1. package/bin/action/verify.js +16 -5
  2. package/bin/utilities/releaseContext.js +5 -8
  3. package/lib/context/file.js +38 -14
  4. package/lib/context/local.js +3 -9
  5. package/lib/context/release.js +82 -52
  6. package/lib/frame.js +3 -3
  7. package/lib/index.js +5 -5
  8. package/lib/metavariable.js +9 -9
  9. package/lib/proofStep.js +21 -18
  10. package/lib/releaseContext/create.js +8 -9
  11. package/lib/releaseContext/initialise.js +67 -0
  12. package/lib/rule.js +5 -5
  13. package/lib/substitution/statementForMetavariable.js +8 -8
  14. package/lib/substitution/termForVariable.js +29 -30
  15. package/lib/substitution.js +7 -7
  16. package/lib/substitutions.js +7 -7
  17. package/lib/topLevelAssertion.js +5 -5
  18. package/lib/unifier/equality.js +7 -7
  19. package/lib/unifier/intrinsicLevel.js +4 -4
  20. package/lib/unifier/metaLevel.js +10 -10
  21. package/lib/unifier/statementWithCombinator.js +147 -0
  22. package/lib/unifier/{termAgainstConstructor.js → termWithConstructor.js} +17 -17
  23. package/lib/unify/conclusionWithStatement.js +34 -0
  24. package/lib/unify/consequentWithStatement.js +34 -0
  25. package/lib/unify/metavariableWithStatement.js +74 -0
  26. package/lib/unify/premiseWithProofStep.js +41 -0
  27. package/lib/unify/premisesWithProofSteps.js +31 -0
  28. package/lib/unify/statementAtainstStatement.js +18 -18
  29. package/lib/unify/statementWithBracketedCombinator.js +30 -0
  30. package/lib/unify/statementWithCombinators.js +40 -0
  31. package/lib/unify/statementWithMetaType.js +24 -0
  32. package/lib/unify/suppositionWithProffStep.js +41 -0
  33. package/lib/unify/suppositionsWithProofSteps.js +31 -0
  34. package/lib/unify/termWithBracketedConstructor.js +37 -0
  35. package/lib/unify/termWithConstructors.js +53 -0
  36. package/lib/unify/termWithTerm.js +21 -0
  37. package/lib/unify/termWithType.js +24 -0
  38. package/lib/unify/variableWithTerm.js +54 -0
  39. package/lib/utilities/assignments.js +9 -12
  40. package/lib/verifier/intrinsicLevel.js +140 -0
  41. package/lib/verifier/metaLevel.js +11 -20
  42. package/lib/verifier/statementAsCombinator.js +9 -9
  43. package/lib/verifier/termAsConstructor.js +5 -5
  44. package/lib/verify/assertion/contained.js +2 -3
  45. package/lib/verify/assertion/defined.js +2 -4
  46. package/lib/verify/assertion/subproof.js +20 -18
  47. package/lib/verify/assertion/type.js +1 -2
  48. package/lib/verify/declaration.js +27 -9
  49. package/lib/verify/error.js +2 -2
  50. package/lib/verify/frame.js +25 -6
  51. package/lib/verify/judgement.js +3 -3
  52. package/lib/verify/metavariable.js +4 -4
  53. package/lib/verify/premise.js +3 -3
  54. package/lib/verify/proofStep.js +23 -30
  55. package/lib/verify/statement/qualified.js +93 -137
  56. package/lib/verify/statement/unqualified.js +18 -104
  57. package/lib/verify/statement.js +95 -76
  58. package/lib/verify/statementAsCombinator.js +3 -3
  59. package/lib/verify/statementGivenMetaType.js +41 -0
  60. package/lib/verify/supposition.js +3 -3
  61. package/lib/verify/term.js +36 -64
  62. package/lib/verify/termAsConstructor.js +2 -2
  63. package/lib/verify/termGivenType.js +34 -0
  64. package/package.json +1 -1
  65. package/src/context/file.js +42 -17
  66. package/src/context/local.js +4 -13
  67. package/src/context/release.js +84 -45
  68. package/src/frame.js +2 -2
  69. package/src/index.js +1 -1
  70. package/src/metavariable.js +6 -6
  71. package/src/proofStep.js +24 -19
  72. package/src/releaseContext/create.js +8 -16
  73. package/src/releaseContext/{verify.js → initialise.js} +32 -23
  74. package/src/rule.js +4 -4
  75. package/src/substitution/statementForMetavariable.js +7 -7
  76. package/src/substitution/termForVariable.js +37 -34
  77. package/src/substitution.js +5 -5
  78. package/src/substitutions.js +5 -5
  79. package/src/topLevelAssertion.js +4 -4
  80. package/src/unifier/equality.js +6 -6
  81. package/src/unifier/intrinsicLevel.js +3 -3
  82. package/src/unifier/metaLevel.js +9 -9
  83. package/src/unifier/statementWithCombinator.js +55 -0
  84. package/src/unifier/{termAgainstConstructor.js → termWithConstructor.js} +9 -9
  85. package/src/unify/{conclusionAgainstStatement.js → conclusionWithStatement.js} +3 -3
  86. package/src/unify/{consequentAgainstStatement.js → consequentWithStatement.js} +3 -3
  87. package/src/unify/{metavariableAgainstStatement.js → metavariableWithStatement.js} +12 -12
  88. package/src/unify/{premiseAgainstProofStep.js → premiseWithProofStep.js} +5 -5
  89. package/src/unify/{premisesAgainstProofSteps.js → premisesWithProofSteps.js} +3 -3
  90. package/src/unify/statementAtainstStatement.js +14 -14
  91. package/src/unify/statementWithBracketedCombinator.js +22 -0
  92. package/src/unify/statementWithCombinators.js +38 -0
  93. package/src/unify/statementWithMetaType.js +14 -0
  94. package/src/unify/{suppositionAgainstProofStep.js → suppositionWithProffStep.js} +5 -5
  95. package/src/unify/{suppositionsAgainstProofSteps.js → suppositionsWithProofSteps.js} +3 -3
  96. package/src/unify/termWithBracketedConstructor.js +36 -0
  97. package/src/unify/termWithConstructors.js +63 -0
  98. package/src/unify/{termAgainstTerm.js → termWithTerm.js} +4 -4
  99. package/src/unify/termWithType.js +15 -0
  100. package/src/unify/{variableAgainstTerm.js → variableWithTerm.js} +5 -5
  101. package/src/utilities/assignments.js +6 -13
  102. package/src/verifier/intrinsicLevel.js +42 -0
  103. package/src/verifier/metaLevel.js +13 -21
  104. package/src/verifier/statementAsCombinator.js +11 -7
  105. package/src/verifier/termAsConstructor.js +4 -3
  106. package/src/verify/assertion/contained.js +1 -3
  107. package/src/verify/assertion/defined.js +1 -4
  108. package/src/verify/assertion/subproof.js +22 -18
  109. package/src/verify/assertion/type.js +0 -1
  110. package/src/verify/declaration.js +34 -11
  111. package/src/verify/error.js +1 -1
  112. package/src/verify/frame.js +32 -5
  113. package/src/verify/judgement.js +3 -3
  114. package/src/verify/metavariable.js +3 -3
  115. package/src/verify/premise.js +3 -3
  116. package/src/verify/proofStep.js +26 -38
  117. package/src/verify/statement/qualified.js +104 -184
  118. package/src/verify/statement/unqualified.js +19 -149
  119. package/src/verify/statement.js +126 -72
  120. package/src/verify/statementAsCombinator.js +2 -2
  121. package/src/verify/statementGivenMetaType.js +37 -0
  122. package/src/verify/supposition.js +3 -3
  123. package/src/verify/term.js +38 -93
  124. package/src/verify/termAsConstructor.js +1 -1
  125. package/src/verify/termGivenType.js +32 -0
  126. package/lib/releaseContext/verify.js +0 -66
  127. package/lib/unifier/statementAgainstCombinator.js +0 -147
  128. package/lib/unify/conclusionAgainstStatement.js +0 -34
  129. package/lib/unify/consequentAgainstStatement.js +0 -34
  130. package/lib/unify/metavariableAgainstStatement.js +0 -74
  131. package/lib/unify/premiseAgainstProofStep.js +0 -41
  132. package/lib/unify/premisesAgainstProofSteps.js +0 -31
  133. package/lib/unify/statementAgainstMetaType.js +0 -48
  134. package/lib/unify/suppositionAgainstProofStep.js +0 -41
  135. package/lib/unify/suppositionsAgainstProofSteps.js +0 -31
  136. package/lib/unify/termAgainstTerm.js +0 -21
  137. package/lib/unify/termAgainstType.js +0 -32
  138. package/lib/unify/variableAgainstTerm.js +0 -54
  139. package/src/unifier/statementAgainstCombinator.js +0 -55
  140. package/src/unify/statementAgainstMetaType.js +0 -50
  141. package/src/unify/termAgainstType.js +0 -31
package/src/index.js CHANGED
@@ -4,6 +4,6 @@ export { default as Log } from "./log";
4
4
  export { default as verifyRelease } from "./verify/release";
5
5
  export { default as ReleaseContext } from "./context/release";
6
6
  export { default as createReleaseContext } from "./releaseContext/create";
7
- export { default as verifyReleaseContext } from "./releaseContext/verify";
8
7
  export { default as customGrammarUtilities } from "./utilities/customGrammar";
8
+ export { default as initialiseReleaseContext } from "./releaseContext/initialise";
9
9
 
@@ -63,9 +63,9 @@ export default class Metavariable {
63
63
  } else if ((termNode === null) && (this.termType === null)) {
64
64
  matchesNode = true;
65
65
  } else if ((termNode !== null) && (this.termType !== null)) {
66
- const termUnifiedAgainstTermType = unifyTermAgainstTermType(termNode, this.termType, localContext);
66
+ const termUnifiedWithTermType = unifyTermWithTermType(termNode, this.termType, localContext);
67
67
 
68
- matchesNode = termUnifiedAgainstTermType; ///
68
+ matchesNode = termUnifiedWithTermType; ///
69
69
  }
70
70
  }
71
71
  }
@@ -90,8 +90,8 @@ export default class Metavariable {
90
90
  }
91
91
  }
92
92
 
93
- export function unifyTermAgainstTermType(termNode, termType, localContext) {
94
- let termUnifiedAgainstTermType;
93
+ export function unifyTermWithTermType(termNode, termType, localContext) {
94
+ let termUnifiedWithTermType;
95
95
 
96
96
  const type = termType, ///
97
97
  terms = [],
@@ -110,9 +110,9 @@ export function unifyTermAgainstTermType(termNode, termType, localContext) {
110
110
  return verifiedAhead;
111
111
  });
112
112
 
113
- termUnifiedAgainstTermType = termVerified; ///
113
+ termUnifiedWithTermType = termVerified; ///
114
114
 
115
- return termUnifiedAgainstTermType;
115
+ return termUnifiedWithTermType;
116
116
  }
117
117
 
118
118
  function termTypeFromMetavariableNode(metavariableNode, fileContext) {
package/src/proofStep.js CHANGED
@@ -17,27 +17,32 @@ export default class ProofStep {
17
17
  return this.statementNode;
18
18
  }
19
19
 
20
- unifyStatement(statementNode, equivalences, localContextA, localContextB) {
20
+ unifyStatement(statementNodeB, equivalences, localContextA, localContextB) {
21
21
  let statementUnified = false;
22
22
 
23
23
  if (this.statementNode !== null) {
24
- let statementUnifiedAgainstStatement = false;
24
+ let statementUnifiedWithStatement = false;
25
25
 
26
- if (!statementUnifiedAgainstStatement) {
27
- const statementNodeA = statementNode, ///
28
- statementNodeB = this.statementNode; ///
26
+ if (!statementUnifiedWithStatement) {
27
+ const statementNodeA = this.statementNode; ///
29
28
 
30
- statementUnifiedAgainstStatement = unifyStatementAgainstStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB);
29
+ statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB);
31
30
  }
32
31
 
33
- if (!statementUnifiedAgainstStatement) {
34
- const statementNodeA = statementNode, ///
35
- statementNodeB = this.statementNode; ///
32
+ if (!statementUnifiedWithStatement) {
33
+ const statementNodeA = statementNodeB, ///
34
+ localContext = localContextA; ///
36
35
 
37
- statementUnifiedAgainstStatement = unifyStatementAgainstStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB);
36
+ statementNodeB = this.statementNode; ///
37
+
38
+ localContextA = localContextB; ///
39
+
40
+ localContextB = localContext; ///
41
+
42
+ statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB);
38
43
  }
39
44
 
40
- statementUnified = statementUnifiedAgainstStatement; ///
45
+ statementUnified = statementUnifiedWithStatement; ///
41
46
  }
42
47
 
43
48
  return statementUnified;
@@ -58,13 +63,13 @@ export default class ProofStep {
58
63
  }
59
64
  }
60
65
 
61
- function unifyStatementAgainstStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB) {
62
- let statementUnifiedAgainstStatement = false;
66
+ function unifyStatementWithStatement(statementNodeA, statementNodeB, equivalences, localContextA, localContextB) {
67
+ let statementUnifiedWithStatement = false;
63
68
 
64
69
  const statementStringA = localContextA.nodeAsString(statementNodeA),
65
70
  statementStringB = localContextB.nodeAsString(statementNodeB);
66
71
 
67
- localContextB.trace(`Unifying the '${statementStringB}' statement against the '${statementStringA}' statement...`, statementNodeB);
72
+ localContextB.trace(`Unifying the '${statementStringB}' statement with the '${statementStringA}' statement...`, statementNodeB);
68
73
 
69
74
  const substitutions = Substitutions.fromNothing(),
70
75
  nodeA = statementNodeA, ///
@@ -72,14 +77,14 @@ function unifyStatementAgainstStatement(statementNodeA, statementNodeB, equivale
72
77
  unified = intrinsicLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
73
78
 
74
79
  if (unified) {
75
- const substitutionsUnifiedAgainstEquivalences = substitutions.unifyAgainstEquivalences(equivalences, localContextA, localContextB);
80
+ const substitutionsUnifiedWithEquivalences = substitutions.unifyWithEquivalences(equivalences, localContextA, localContextB);
76
81
 
77
- statementUnifiedAgainstStatement = substitutionsUnifiedAgainstEquivalences; ///
82
+ statementUnifiedWithStatement = substitutionsUnifiedWithEquivalences; ///
78
83
  }
79
84
 
80
- if (statementUnifiedAgainstStatement) {
81
- localContextB.debug(`...unified the '${statementStringB}' statement against the '${statementStringA}' statement.`, statementNodeB);
85
+ if (statementUnifiedWithStatement) {
86
+ localContextB.debug(`...unified the '${statementStringB}' statement with the '${statementStringA}' statement.`, statementNodeB);
82
87
  }
83
88
 
84
- return statementUnifiedAgainstStatement;
89
+ return statementUnifiedWithStatement;
85
90
  }
@@ -12,11 +12,9 @@ export default function createReleaseContext(dependency, dependentNames, context
12
12
  log.debug(`Creating the '${releaseName}' context given the '${dependencyString}' dependency...`);
13
13
 
14
14
  if (releaseContext !== null) {
15
- const error = null,
16
- version = releaseContext.getVersion(),
17
- versionString = version.toString();
15
+ const error = null;
18
16
 
19
- log.debug(`...already created the '${releaseName}:${versionString}' context.`);
17
+ log.debug(`...already created the '${releaseName}' context.`);
20
18
 
21
19
  callback(error);
22
20
 
@@ -52,20 +50,17 @@ export default function createReleaseContext(dependency, dependentNames, context
52
50
  return;
53
51
  }
54
52
 
55
- const version = releaseContext.getVersion(),
56
- versionString = version.toString();
57
-
58
53
  releaseContextMap[releaseName] = releaseContext;
59
54
 
60
- createDependencyReleaseContexts(dependency, dependentNames, context, (error) => {
55
+ log.info(`...created the '${releaseName}' context.`);
56
+
57
+ createDependencyReleaseContexts(dependency, releaseContext, dependentNames, context, (error) => {
61
58
  if (error) {
62
59
  callback(error);
63
60
 
64
61
  return;
65
62
  }
66
63
 
67
- log.info(`...created the '${releaseName}@${versionString}' context.`);
68
-
69
64
  callback(error);
70
65
  });
71
66
  }, context);
@@ -122,7 +117,7 @@ function checkReleaseMatchesDependency(releaseContext, dependency, dependentName
122
117
  versionString = version.toString(),
123
118
  dependencyString = dependency.asString();
124
119
 
125
- log.error(`Version mismatch: '${dependentName}' requires the '${dependencyString}' dependency but a context with version '${versionString}' was created.`);
120
+ log.warning(`Version mismatch: The '${dependentName}' dependent requires the '${dependencyString}' dependency but a context with version '${versionString}' was provided.`);
126
121
 
127
122
  releaseMatchesDependency = false;
128
123
  }
@@ -131,11 +126,8 @@ function checkReleaseMatchesDependency(releaseContext, dependency, dependentName
131
126
  return releaseMatchesDependency;
132
127
  }
133
128
 
134
- function createDependencyReleaseContexts(dependency, dependentNames, context, callback) {
135
- const { releaseContextMap } = context,
136
- dependencyName = dependency.getName(),
137
- releaseName = dependencyName, ///
138
- releaseContext = releaseContextMap[releaseName],
129
+ function createDependencyReleaseContexts(dependency, releaseContext, dependentNames, context, callback) {
130
+ const dependencyName = dependency.getName(),
139
131
  dependencies = releaseContext.getDependencies();
140
132
 
141
133
  dependentNames = [ ...dependentNames, dependencyName ]; ///
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- export default function verifyReleaseContext(dependency, dependentName, dependentReleased, context) {
4
- let releaseContextVerified = false;
3
+ export default function initialiseReleaseContext(dependency, dependentName, dependentReleased, context) {
4
+ let releaseContextInitialised = false;
5
5
 
6
6
  const { releaseContextMap } = context,
7
7
  dependencyName = dependency.getName(),
@@ -11,44 +11,37 @@ export default function verifyReleaseContext(dependency, dependentName, dependen
11
11
  if (releaseContext === null) {
12
12
  const { log } = context;
13
13
 
14
- log.error(`Unable to verify the '${dependencyName}' dependency's context because it has not been created.`);
14
+ log.warning(`Unable to initialise the '${dependencyName}' ontext because it has not been created.`);
15
15
  } else {
16
- const verified = releaseContext.isVerified();
16
+ releaseContextInitialised = releaseContext.isInitialised();
17
17
 
18
- if (verified) {
19
- releaseContextVerified = true;
20
- } else {
18
+ if (!releaseContextInitialised) {
21
19
  const released = releaseContext.isReleased();
22
20
 
23
21
  if (!released && dependentReleased) {
24
22
  const { log } = context;
25
23
 
26
- log.error(`Unable to verify the '${dependencyName}' dependency's context because its '${dependentName}' dependent is a package.`);
24
+ log.warning(`Unable to initialise the '${dependencyName}' dependency's context because its '${dependentName}' dependent is a package.`);
27
25
  } else {
28
- const dependencies = releaseContext.getDependencies();
26
+ const dependencyReleaseContextsInitialised = initialiseDependencyReleaseContexts(dependency, releaseContext, released, context);
29
27
 
30
- dependentName = dependencyName; ///
28
+ if (dependencyReleaseContextsInitialised) {
29
+ const { log } = context,
30
+ releaseContexts = retrieveReleaseContexts(releaseContext, releaseContextMap);
31
31
 
32
- dependentReleased = released; ///
32
+ log.debug(`Initialising the '${dependencyName}' context...`);
33
33
 
34
- releaseContextVerified = dependencies.everyDependency((dependency) => { ///
35
- const releaseContextVerified = verifyReleaseContext(dependency, dependentName, dependentReleased, context);
34
+ releaseContextInitialised = releaseContext.initialise(releaseContexts);
36
35
 
37
- if (releaseContextVerified) {
38
- return true;
39
- }
40
- });
41
-
42
- if (releaseContextVerified) {
43
- const releaseContexts = retrieveReleaseContexts(releaseContext, releaseContextMap);
44
-
45
- releaseContext.verify(releaseContexts);
36
+ releaseContextInitialised ?
37
+ log.info(`...initialised the '${dependencyName}' context.`) :
38
+ log.warning(`...unable to initialise the '${dependencyName}' context.`);
46
39
  }
47
40
  }
48
41
  }
49
42
  }
50
43
 
51
- return releaseContextVerified;
44
+ return releaseContextInitialised;
52
45
  }
53
46
 
54
47
  function retrieveReleaseContexts(releaseContext, releaseContextMap) {
@@ -87,3 +80,19 @@ function retrieveReleaseContexts(releaseContext, releaseContextMap) {
87
80
 
88
81
  return releaseContexts;
89
82
  }
83
+
84
+ function initialiseDependencyReleaseContexts(dependency, releaseContext, released, context) {
85
+ const dependencyName = dependency.getName(),
86
+ dependentName = dependencyName, ///
87
+ dependencies = releaseContext.getDependencies(),
88
+ dependentReleased = released, ///
89
+ dependencyReleaseContextsInitialised = dependencies.everyDependency((dependency) => { ///
90
+ const releaseContextInitialised = initialiseReleaseContext(dependency, dependentName, dependentReleased, context);
91
+
92
+ if (releaseContextInitialised) {
93
+ return true;
94
+ }
95
+ });
96
+
97
+ return dependencyReleaseContextsInitialised;
98
+ }
package/src/rule.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import Substitutions from "./substitutions";
4
- import unifyPremisesAgainstProofSteps from "./unify/premisesAgainstProofSteps";
5
- import unifyConclusionAgainstStatement from "./unify/conclusionAgainstStatement";
4
+ import unifyPremisesWithProofSteps from "./unify/premisesWithProofSteps";
5
+ import unifyConclusionWithStatement from "./unify/conclusionWithStatement";
6
6
 
7
7
  export default class Rule {
8
8
  constructor(labels, premises, conclusion, fileContext) {
@@ -37,11 +37,11 @@ export default class Rule {
37
37
  proofStepsB = proofSteps, ///
38
38
  fileContextA = this.fileContext, ///
39
39
  localContextB = localContext, ///
40
- premisesUnified = unifyPremisesAgainstProofSteps(premisesA, proofStepsB, substitutions, fileContextA, localContextB);
40
+ premisesUnified = unifyPremisesWithProofSteps(premisesA, proofStepsB, substitutions, fileContextA, localContextB);
41
41
 
42
42
  if (premisesUnified) {
43
43
  const conclusionA = this.conclusion, ///
44
- conclusionUnified = unifyConclusionAgainstStatement(conclusionA, statementNode, substitutions, fileContextA, localContextB);
44
+ conclusionUnified = unifyConclusionWithStatement(conclusionA, statementNode, substitutions, fileContextA, localContextB);
45
45
 
46
46
  statementUnified = conclusionUnified; ///
47
47
  }
@@ -3,7 +3,7 @@
3
3
  import shim from "../shim";
4
4
  import Substitution from "../substitution";
5
5
  import TermForVariableSubstitution from "./termForVariable";
6
- import unifyStatementAgainstStatement from "../unify/statementAtainstStatement";
6
+ import unifyStatementWithStatement from "../unify/statementAtainstStatement";
7
7
 
8
8
  import { nodeQuery } from "../utilities/query";
9
9
  import { matchStatementModuloBrackets, bracketedStatementChildNodeFromStatementNode } from "../utilities/match";
@@ -74,8 +74,8 @@ export default class StatementForMetavariableSubstitution extends Substitution {
74
74
  return statementNodeMatches;
75
75
  }
76
76
 
77
- unifyAgainstEquivalence(equivalence, substitutions, localContextA, localContextB) {
78
- let unifiedAgainstEquivalence = false; ///
77
+ unifyWithEquivalence(equivalence, substitutions, localContextA, localContextB) {
78
+ let unifiedWithEquivalence = false; ///
79
79
 
80
80
  const metavariableNode = metavariableNodeQuery(this.statementNode);
81
81
 
@@ -89,10 +89,10 @@ export default class StatementForMetavariableSubstitution extends Substitution {
89
89
  nodeB = metavariableNode, ///
90
90
  unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
91
91
 
92
- unifiedAgainstEquivalence = unified; ///
92
+ unifiedWithEquivalence = unified; ///
93
93
  }
94
94
 
95
- return unifiedAgainstEquivalence;
95
+ return unifiedWithEquivalence;
96
96
  }
97
97
 
98
98
  asString(localContextA, localContextB) {
@@ -156,9 +156,9 @@ function unifyStatement(statementNodeA, statementNodeB, substitution, substituti
156
156
 
157
157
  statementUnified = statementNodeAMatchesStatementNodeB; ///
158
158
  } else {
159
- const statementUnifiedAgainstStatement = unifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
159
+ const statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
160
160
 
161
- statementUnified = statementUnifiedAgainstStatement; ///
161
+ statementUnified = statementUnifiedWithStatement; ///
162
162
  }
163
163
 
164
164
  return statementUnified;
@@ -29,14 +29,21 @@ export default class TermForVariableSubstitution extends Substitution {
29
29
  return node;
30
30
  }
31
31
 
32
- isTransformed(substitution) {
33
- const termNod = substitution.getTermNode(),
34
- variableNode = substitution.getVariableNode(),
35
- termNodeMatches = this.termNode.match(termNod),
36
- variableNodeMatches = this.variableNode.match(variableNode),
37
- transformed = ((!termNodeMatches) && (!variableNodeMatches));
38
-
39
- return transformed;
32
+ transformed(substitutions) {
33
+ let transformedSubstitution = null;
34
+
35
+ const transformedTermNode = transformTermNode(this.termNode, substitutions),
36
+ transformedVariableNode = transformVariableNode(this.variableNode, substitutions);
37
+
38
+ if ((transformedTermNode !== null) && (transformedVariableNode !== null)) {
39
+ const termNode = transformedTermNode, ///
40
+ variableNode = transformedVariableNode,
41
+ termForVariableSubstitution = new TermForVariableSubstitution(termNode, variableNode);
42
+
43
+ transformedSubstitution = termForVariableSubstitution; ///
44
+ }
45
+
46
+ return transformedSubstitution;
40
47
  }
41
48
 
42
49
  matchTermNode(termNode) {
@@ -51,8 +58,8 @@ export default class TermForVariableSubstitution extends Substitution {
51
58
  return matchesVariableNode;
52
59
  }
53
60
 
54
- unifyAgainstEquivalence(equivalence, substitutions, localContextA, localContextB) {
55
- let unifiedAgainstEquivalence;
61
+ unifyWithEquivalence(equivalence, substitutions, localContextA, localContextB) {
62
+ let unifiedWithEquivalence;
56
63
 
57
64
  const equivalenceMatchesVariableNode = equivalence.matchVariableNode(this.variableNode);
58
65
 
@@ -60,11 +67,11 @@ export default class TermForVariableSubstitution extends Substitution {
60
67
  const equivalenceMatchesTermNode = equivalence.matchTermNode(this.termNode);
61
68
 
62
69
  if (equivalenceMatchesTermNode) {
63
- unifiedAgainstEquivalence = true;
70
+ unifiedWithEquivalence = true;
64
71
  }
65
72
  }
66
73
 
67
- return unifiedAgainstEquivalence;
74
+ return unifiedWithEquivalence;
68
75
  }
69
76
 
70
77
  asString(localContextA, localContextB) {
@@ -95,22 +102,12 @@ export default class TermForVariableSubstitution extends Substitution {
95
102
  let termNode = substitution.getTermNode(),
96
103
  variableNode = substitution.getVariableNode();
97
104
 
98
- termNode = substituteTermNode(termNode, substitutions); ///
105
+ const transformedTermNode = transformTermNode(termNode, substitutions),
106
+ transformedVariableNode = transformVariableNode(variableNode, substitutions); ///
99
107
 
100
- variableNode = substituteVariableNode(variableNode, substitutions); ///
108
+ termNode = transformedTermNode; ///
101
109
 
102
- const termForVariableSubstitution = new TermForVariableSubstitution(variableNode, termNode);
103
-
104
- return termForVariableSubstitution;
105
- }
106
-
107
- static fromSubstitutionNodeAndSubstitutions(substitutionNode, substitutions) {
108
- let termNode = termNodeQuery(substitutionNode),
109
- variableNode = variableNodeQuery(substitutionNode);
110
-
111
- termNode = substituteTermNode(termNode, substitutions); ///
112
-
113
- variableNode = substituteVariableNode(variableNode, substitutions); ///
110
+ variableNode = transformedVariableNode; ///
114
111
 
115
112
  const termForVariableSubstitution = new TermForVariableSubstitution(variableNode, termNode);
116
113
 
@@ -118,7 +115,9 @@ export default class TermForVariableSubstitution extends Substitution {
118
115
  }
119
116
  }
120
117
 
121
- function substituteTermNode(termNode, substitutions) {
118
+ function transformTermNode(termNode, substitutions) {
119
+ let transformedTermNode = null;
120
+
122
121
  const termVariableNode = variableNodeQuery(termNode);
123
122
 
124
123
  if (termVariableNode !== null) {
@@ -126,31 +125,35 @@ function substituteTermNode(termNode, substitutions) {
126
125
  const substitutionMatchesVariableNode = substitution.matchVariableNode(termVariableNode);
127
126
 
128
127
  if (substitutionMatchesVariableNode) {
129
- termNode = substitution.getTermNode(); ///
128
+ const termNode = substitution.getTermNode();
129
+
130
+ transformedTermNode = termNode; ////
130
131
 
131
132
  return true;
132
133
  }
133
134
  });
134
135
  }
135
136
 
136
- return termNode;
137
+ return transformedTermNode;
137
138
  }
138
139
 
139
- function substituteVariableNode(variableNode, substitutions) {
140
+ function transformVariableNode(variableNode, substitutions) {
141
+ let transformedVariableNode = null;
142
+
140
143
  substitutions.someSubstitution((substitution) => {
141
144
  const substitutionMatchesVariableNode = substitution.matchVariableNode(variableNode);
142
145
 
143
146
  if (substitutionMatchesVariableNode) {
144
147
  const termNode = substitution.getTermNode(),
145
- termVariableNode = variableNodeQuery(termNode);
148
+ variableNode = variableNodeQuery(termNode);
146
149
 
147
- if (termVariableNode !== null) {
148
- variableNode = termVariableNode; ///
150
+ if (variableNode !== null) {
151
+ transformedVariableNode = variableNode; ///
149
152
 
150
153
  return true;
151
154
  }
152
155
  }
153
156
  });
154
157
 
155
- return variableNode;
158
+ return transformedVariableNode;
156
159
  }
@@ -25,15 +25,15 @@ export default class Substitution {
25
25
  return matchesMetavariableNode;
26
26
  }
27
27
 
28
- unifyAgainstEquivalences(equivalences, substitutions, localContextA, localContextB) {
29
- const unifiedAgainstEquivalences = equivalences.some((equivalence) => {
30
- const substitutionUnifiedAgainstEquivalence = this.unifyAgainstEquivalence(equivalence, substitutions, localContextA, localContextB);
28
+ unifyWithEquivalences(equivalences, substitutions, localContextA, localContextB) {
29
+ const unifiedWithEquivalences = equivalences.some((equivalence) => {
30
+ const substitutionUnifiedWithEquivalence = this.unifyWithEquivalence(equivalence, substitutions, localContextA, localContextB);
31
31
 
32
- if (substitutionUnifiedAgainstEquivalence) {
32
+ if (substitutionUnifiedWithEquivalence) {
33
33
  return true;
34
34
  }
35
35
  });
36
36
 
37
- return unifiedAgainstEquivalences;
37
+ return unifiedWithEquivalences;
38
38
  }
39
39
  }
@@ -55,17 +55,17 @@ export default class Substitutions {
55
55
  localContextB.trace(`Removed the '${substitutionString}' substitution.`, substitutionNode);
56
56
  }
57
57
 
58
- unifyAgainstEquivalences(equivalences, localContextA, localContextB) {
59
- const unifiedAgainstEquivalences = this.everySubstitution((substitution) => {
58
+ unifyWithEquivalences(equivalences, localContextA, localContextB) {
59
+ const unifiedWithEquivalences = this.everySubstitution((substitution) => {
60
60
  const substitutions = this, ///
61
- substitutionUnifiedAgainstEquivalence = substitution.unifyAgainstEquivalences(equivalences, substitutions, localContextA, localContextB);
61
+ substitutionUnifiedWithEquivalence = substitution.unifyWithEquivalences(equivalences, substitutions, localContextA, localContextB);
62
62
 
63
- if (substitutionUnifiedAgainstEquivalence) {
63
+ if (substitutionUnifiedWithEquivalence) {
64
64
  return true;
65
65
  }
66
66
  });
67
67
 
68
- return unifiedAgainstEquivalences;
68
+ return unifiedWithEquivalences;
69
69
  }
70
70
 
71
71
  snapshot() {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import Substitutions from "./substitutions";
4
- import unifyConsequentAgainstStatement from "./unify/consequentAgainstStatement";
5
- import unifySuppositionsAgainstProofSteps from "./unify/suppositionsAgainstProofSteps";
4
+ import unifyConsequentWithStatement from "./unify/consequentWithStatement";
5
+ import unifySuppositionsWithProofSteps from "./unify/suppositionsWithProofSteps";
6
6
 
7
7
  export default class TopLevelAssertion {
8
8
  constructor(labels, suppositions, consequent, substitutions, fileContext) {
@@ -42,11 +42,11 @@ export default class TopLevelAssertion {
42
42
  fileContextA = this.fileContext, ///
43
43
  suppositionsA = this.suppositions, ///
44
44
  localContextB = localContext, ///
45
- suppositionsUnified = unifySuppositionsAgainstProofSteps(suppositionsA, proofStepsB, substitutions, fileContextA, localContextB);
45
+ suppositionsUnified = unifySuppositionsWithProofSteps(suppositionsA, proofStepsB, substitutions, fileContextA, localContextB);
46
46
 
47
47
  if (suppositionsUnified) {
48
48
  const consequentA = this.consequent, ///
49
- consequentUnified = unifyConsequentAgainstStatement(consequentA, statementNode, substitutions, fileContextA, localContext);
49
+ consequentUnified = unifyConsequentWithStatement(consequentA, statementNode, substitutions, fileContextA, localContext);
50
50
 
51
51
  statementUnified = consequentUnified; ///
52
52
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import Unifier from "../unifier";
4
- import unifyTermAgainstTerm from "../unify/termAgainstTerm";
4
+ import unifyTermWithTerm from "../unify/termWithTerm";
5
5
 
6
6
  import { nodeQuery } from "../utilities/query";
7
7
 
@@ -25,14 +25,14 @@ class EqualityUnifier extends Unifier {
25
25
  nodeQueryA: termNodeQuery,
26
26
  nodeQueryB: termNodeQuery,
27
27
  unify: (termNodeA, termNodeB, localContext) => {
28
- let termUnifiedAgainstTerm;
28
+ let termUnifiedWithTerm;
29
29
 
30
30
  const leftTermNode = termNodeA, ///
31
31
  rightTermNode = termNodeB; ///
32
32
 
33
- termUnifiedAgainstTerm = unifyTermAgainstTerm(leftTermNode, rightTermNode, localContext);
33
+ termUnifiedWithTerm = unifyTermWithTerm(leftTermNode, rightTermNode, localContext);
34
34
 
35
- if (!termUnifiedAgainstTerm) {
35
+ if (!termUnifiedWithTerm) {
36
36
  const nonTerminalNodeA = termNodeA, ///
37
37
  nonTerminalNodeB = termNodeB, ///
38
38
  nonTerminalNodeAChildNodes = nonTerminalNodeA.getChildNodes(),
@@ -41,10 +41,10 @@ class EqualityUnifier extends Unifier {
41
41
  childNodesB = nonTerminalNodeBChildNodes, ///
42
42
  childNodesVerified = equalityUnifier.unifyChildNodes(childNodesA, childNodesB, localContext);
43
43
 
44
- termUnifiedAgainstTerm = childNodesVerified; ///
44
+ termUnifiedWithTerm = childNodesVerified; ///
45
45
  }
46
46
 
47
- return termUnifiedAgainstTerm;
47
+ return termUnifiedWithTerm;
48
48
  }
49
49
  }
50
50
  ];
@@ -2,7 +2,7 @@
2
2
 
3
3
  import shim from "../shim";
4
4
  import Unifier from "../unifier";
5
- import unifyVariableAgainstTerm from "../unify/variableAgainstTerm";
5
+ import unifyVariableWithTerm from "../unify/variableWithTerm";
6
6
 
7
7
  import { nodeQuery } from "../utilities/query";
8
8
 
@@ -28,9 +28,9 @@ class IntrinsicLevelUnifier extends Unifier {
28
28
  nodeQueryB: termNodeQuery,
29
29
  unify: (termVariableNodeA, termNodeB, substitutions, localContextA, localContextB) => {
30
30
  const variableNodeA = termVariableNodeA, ///
31
- variableUnifiedAgainstTerm = unifyVariableAgainstTerm(variableNodeA, termNodeB, substitutions, localContextA, localContextB);
31
+ variableUnifiedWithTerm = unifyVariableWithTerm(variableNodeA, termNodeB, substitutions, localContextA, localContextB);
32
32
 
33
- return variableUnifiedAgainstTerm;
33
+ return variableUnifiedWithTerm;
34
34
  }
35
35
  }
36
36
  ];