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
@@ -2,8 +2,8 @@
2
2
 
3
3
  import shim from "../shim";
4
4
  import Unifier from "../unifier";
5
- import unifyVariableAgainstTerm from "../unify/variableAgainstTerm";
6
- import unifyMetavariableAgainstStatement from "../unify/metavariableAgainstStatement";
5
+ import unifyVariableWithTerm from "../unify/variableWithTerm";
6
+ import unifyMetavariableWithStatement from "../unify/metavariableWithStatement";
7
7
 
8
8
  import { nodeQuery } from "../utilities/query";
9
9
 
@@ -31,15 +31,15 @@ class MetaLevelUnifier extends Unifier {
31
31
  nodeQueryA: statementNodeQuery,
32
32
  nodeQueryB: statementNodeQuery,
33
33
  unify: (statementNodeA, statementNodeB, substitutions, localContextA, localContextB) => {
34
- let statementUnifiedAgainstStatement;
34
+ let statementUnifiedWithStatement;
35
35
 
36
36
  const metavariableNodeA = metavariableNodeQuery(statementNodeA);
37
37
 
38
38
  if (metavariableNodeA !== null) {
39
39
  const substitutionNodeA = substitutionNodeQuery(statementNodeA),
40
- metavariableUnifiedAgainstStatement = unifyMetavariableAgainstStatement(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB);
40
+ metavariableUnifiedWithStatement = unifyMetavariableWithStatement(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB);
41
41
 
42
- statementUnifiedAgainstStatement = metavariableUnifiedAgainstStatement; ///
42
+ statementUnifiedWithStatement = metavariableUnifiedWithStatement; ///
43
43
  } else {
44
44
  const nonTerminalNodeA = statementNodeA, ///
45
45
  nonTerminalNodeB = statementNodeB, ///
@@ -49,10 +49,10 @@ class MetaLevelUnifier extends Unifier {
49
49
  childNodesB = nonTerminalNodeBChildNodes, ///
50
50
  childNodesVerified = metaLevelUnifier.unifyChildNodes(childNodesA, childNodesB, substitutions, localContextA, localContextB);
51
51
 
52
- statementUnifiedAgainstStatement = childNodesVerified; ///
52
+ statementUnifiedWithStatement = childNodesVerified; ///
53
53
  }
54
54
 
55
- return statementUnifiedAgainstStatement;
55
+ return statementUnifiedWithStatement;
56
56
  }
57
57
  },
58
58
  {
@@ -60,9 +60,9 @@ class MetaLevelUnifier extends Unifier {
60
60
  nodeQueryB: termNodeQuery,
61
61
  unify: (termVariableNodeA, termNodeB, substitutions, localContextA, localContextB) => {
62
62
  const variableNodeA = termVariableNodeA, ///
63
- variableUnifiedAgainstTerm = unifyVariableAgainstTerm(variableNodeA, termNodeB, substitutions, localContextA, localContextB);
63
+ variableUnifiedWithTerm = unifyVariableWithTerm(variableNodeA, termNodeB, substitutions, localContextA, localContextB);
64
64
 
65
- return variableUnifiedAgainstTerm;
65
+ return variableUnifiedWithTerm;
66
66
  }
67
67
  }
68
68
  ];
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ import Unifier from "../unifier";
4
+ import unifyTermWithType from "../unify/termWithType";
5
+ import unifyStatementWithMetaType from "../unify/statementWithMetaType";
6
+
7
+ import { nodeQuery } from "../utilities/query";
8
+
9
+ const termNodeQuery = nodeQuery("/term!"),
10
+ typeNodeQuery = nodeQuery("/type!"),
11
+ metaTypeNodeQuery = nodeQuery("/metaType!"),
12
+ statementNodeQuery = nodeQuery("/statement!");
13
+
14
+ class StatementWithCombinatorUnifier extends Unifier {
15
+ unify(statementNode, combinatorStatementNode, assignments, derived, localContext) {
16
+ let statementUnifiedWithCombinator;
17
+
18
+ const nonTerminalNodeA = statementNode, ///
19
+ nonTerminalNodeB = combinatorStatementNode, ///
20
+ nonTerminalNodeUnified = this.unifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, assignments, derived, localContext);
21
+
22
+ statementUnifiedWithCombinator = nonTerminalNodeUnified; ///
23
+
24
+ return statementUnifiedWithCombinator;
25
+ };
26
+
27
+ static maps = [
28
+ {
29
+ nodeQueryA: statementNodeQuery,
30
+ nodeQueryB: metaTypeNodeQuery,
31
+ unify: (statementNodeA, metaTypeNodeB, assignments, derived, localContext) => {
32
+ const metaTypeNode = metaTypeNodeB, ///
33
+ statementNode = statementNodeA, ///
34
+ statementUnifiedWithMetaType = unifyStatementWithMetaType(statementNode, metaTypeNode, assignments, derived, localContext);
35
+
36
+ return statementUnifiedWithMetaType;
37
+ }
38
+ },
39
+ {
40
+ nodeQueryA: termNodeQuery,
41
+ nodeQueryB: typeNodeQuery,
42
+ unify: (termNodeA, typeNodeB, assignments, derived, localContext) => {
43
+ const termNode = termNodeA, ///
44
+ typeNode = typeNodeB, ///
45
+ termUnifiedWithType = unifyTermWithType(termNode, typeNode, localContext);
46
+
47
+ return termUnifiedWithType;
48
+ }
49
+ }
50
+ ];
51
+ }
52
+
53
+ const statementWithCombinatorUnifier = new StatementWithCombinatorUnifier();
54
+
55
+ export default statementWithCombinatorUnifier;
@@ -1,24 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  import Unifier from "../unifier";
4
- import unifyTermAgainstType from "../unify/termAgainstType";
4
+ import unifyTermWithType from "../unify/termWithType";
5
5
 
6
6
  import { nodeQuery } from "../utilities/query";
7
7
 
8
8
  const termNodeQuery = nodeQuery("/term"),
9
9
  typeNodeQuery = nodeQuery("/type");
10
10
 
11
- class TermAgainstConstructorUnifier extends Unifier {
11
+ class TermWithConstructorUnifier extends Unifier {
12
12
  unify(termNode, constructorTermNode, localContext) {
13
- let termUnifiedAgainstConstructor;
13
+ let termUnifiedWithConstructor;
14
14
 
15
15
  const nonTerminalNodeA = termNode, ///
16
16
  nonTerminalNodeB = constructorTermNode, ///
17
17
  nonTerminalNodeUnified = this.unifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext);
18
18
 
19
- termUnifiedAgainstConstructor = nonTerminalNodeUnified; ///
19
+ termUnifiedWithConstructor = nonTerminalNodeUnified; ///
20
20
 
21
- return termUnifiedAgainstConstructor;
21
+ return termUnifiedWithConstructor;
22
22
  };
23
23
 
24
24
  static maps = [
@@ -28,14 +28,14 @@ class TermAgainstConstructorUnifier extends Unifier {
28
28
  unify: (termNodeA, typeNodeB, localContext) => {
29
29
  const termNode = termNodeA, ///
30
30
  typeNode = typeNodeB, ///
31
- termUnifiedAgainstType = unifyTermAgainstType(termNode, typeNode, localContext);
31
+ termUnifiedWithType = unifyTermWithType(termNode, typeNode, localContext);
32
32
 
33
- return termUnifiedAgainstType;
33
+ return termUnifiedWithType;
34
34
  }
35
35
  }
36
36
  ];
37
37
  }
38
38
 
39
- const termAgainstConstructorUnifier = new TermAgainstConstructorUnifier();
39
+ const termWithConstructorUnifier = new TermWithConstructorUnifier();
40
40
 
41
- export default termAgainstConstructorUnifier;
41
+ export default termWithConstructorUnifier;
@@ -2,7 +2,7 @@
2
2
 
3
3
  import LocalContext from "../context/local";
4
4
 
5
- export default function unifyConclusionAgainstStatement(conclusionA, statementNodeB, substitutions, fileContextA, localContextB) {
5
+ export default function unifyConclusionWithStatement(conclusionA, statementNodeB, substitutions, fileContextA, localContextB) {
6
6
  let conclusionUnified = false;
7
7
 
8
8
  const conclusionAStatementNode = conclusionA.getStatementNode();
@@ -15,7 +15,7 @@ export default function unifyConclusionAgainstStatement(conclusionA, statementNo
15
15
 
16
16
  substitutions.snapshot();
17
17
 
18
- localContextB.trace(`Unifying the '${statementStringB}' statement against the conclusion's '${statementStringA}' statement...`, statementNodeB);
18
+ localContextB.trace(`Unifying the '${statementStringB}' statement with the conclusion's '${statementStringA}' statement...`, statementNodeB);
19
19
 
20
20
  const statementUnified = conclusionA.unifyStatement(statementNodeB, substitutions, localContextA, localContextB);
21
21
 
@@ -26,7 +26,7 @@ export default function unifyConclusionAgainstStatement(conclusionA, statementNo
26
26
  substitutions.rollback(localContextA, localContextB);
27
27
 
28
28
  if (conclusionUnified) {
29
- localContextB.debug(`...unified the '${statementStringB}' statement against the conclusion's '${statementStringA}' statement.`, statementNodeB);
29
+ localContextB.debug(`...unified the '${statementStringB}' statement with the conclusion's '${statementStringA}' statement.`, statementNodeB);
30
30
  }
31
31
  }
32
32
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import LocalContext from "../context/local";
4
4
 
5
- export default function unifyConsequentAgainstStatement(consequentA, statementNodeB, substitutions, fileContextA, localContextB) {
5
+ export default function unifyConsequentWithStatement(consequentA, statementNodeB, substitutions, fileContextA, localContextB) {
6
6
  let consequentUnified = false;
7
7
 
8
8
  const consequentAStatementNode = consequentA.getStatementNode();
@@ -15,7 +15,7 @@ export default function unifyConsequentAgainstStatement(consequentA, statementNo
15
15
 
16
16
  substitutions.snapshot();
17
17
 
18
- localContextB.trace(`Unifying the '${statementStringB}' statement against the consequent's '${statementStringA}' statement...`, statementNodeB);
18
+ localContextB.trace(`Unifying the '${statementStringB}' statement with the consequent's '${statementStringA}' statement...`, statementNodeB);
19
19
 
20
20
  const statementUnified = consequentA.unifyStatement(statementNodeB, substitutions, localContextA, localContextB);
21
21
 
@@ -26,7 +26,7 @@ export default function unifyConsequentAgainstStatement(consequentA, statementNo
26
26
  substitutions.rollback(localContextA, localContextB);
27
27
 
28
28
  if (consequentUnified) {
29
- localContextB.debug(`...unified the '${statementStringB}' statement against the consequent's '${statementStringA}' statement.`, statementNodeB);
29
+ localContextB.debug(`...unified the '${statementStringB}' statement with the consequent's '${statementStringA}' statement.`, statementNodeB);
30
30
  }
31
31
  }
32
32
 
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  import TermForVariableSubstitution from "../substitution/termForVariable";
4
- import unifyStatementAgainstStatement from "../unify/statementAtainstStatement";
4
+ import unifyStatementWithStatement from "../unify/statementAtainstStatement";
5
5
  import StatementForMetavariableSubstitution from "../substitution/statementForMetavariable";
6
6
 
7
7
  import { nodeQuery } from "../utilities/query";
8
8
 
9
9
  const metavariableNodeQuery = nodeQuery("/statement/metavariable");
10
10
 
11
- export default function unifyMetavariableAgainstStatement(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB) {
12
- let metavariableUnifiedAgainstStatement = false;
11
+ export default function unifyMetavariableWithStatement(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB) {
12
+ let metavariableUnifiedWithStatement = false;
13
13
 
14
14
  const substitution = substitutions.findSubstitution((substitution) => {
15
15
  const substitutionMatchesMetavariableNodeA = substitution.matchMetavariableNode(metavariableNodeA);
@@ -28,10 +28,10 @@ export default function unifyMetavariableAgainstStatement(metavariableNodeA, sta
28
28
  localContext = localContextB, ///
29
29
  substitution = termForVariableSubstitution, ///
30
30
  statementNodeA = substitutionStatementNode, ///
31
- statementUnifiedAgainstStatement = unifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContext, localContext);
31
+ statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, substitution, substitutions, localContext, localContext);
32
32
 
33
- if (statementUnifiedAgainstStatement) {
34
- metavariableUnifiedAgainstStatement = true;
33
+ if (statementUnifiedWithStatement) {
34
+ metavariableUnifiedWithStatement = true;
35
35
  }
36
36
  } else {
37
37
  const substitutionSubstitution = substitution.getSubstitution();
@@ -43,16 +43,16 @@ export default function unifyMetavariableAgainstStatement(metavariableNodeA, sta
43
43
 
44
44
  const localContext = localContextB, ///
45
45
  substitution = substitutionSubstitution,
46
- statementUnifiedAgainstStatement = unifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContext, localContext);
46
+ statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, substitution, substitutions, localContext, localContext);
47
47
 
48
- if (statementUnifiedAgainstStatement) {
49
- metavariableUnifiedAgainstStatement = true;
48
+ if (statementUnifiedWithStatement) {
49
+ metavariableUnifiedWithStatement = true;
50
50
  }
51
51
  } else {
52
52
  const substitutionMatchesStatementNodeB = substitution.matchStatementNode(statementNodeB);
53
53
 
54
54
  if (substitutionMatchesStatementNodeB) {
55
- metavariableUnifiedAgainstStatement = true;
55
+ metavariableUnifiedWithStatement = true;
56
56
  }
57
57
  }
58
58
  }
@@ -72,11 +72,11 @@ export default function unifyMetavariableAgainstStatement(metavariableNodeA, sta
72
72
  substitutions.addSubstitution(substitution, localContextA, localContextB);
73
73
  }
74
74
 
75
- metavariableUnifiedAgainstStatement = true;
75
+ metavariableUnifiedWithStatement = true;
76
76
  }
77
77
  }
78
78
 
79
- return metavariableUnifiedAgainstStatement;
79
+ return metavariableUnifiedWithStatement;
80
80
  }
81
81
 
82
82
  function metavariableFromStatementNode(statementNode, localContext) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { subproofNodeAsSubproofString } from "../utilities/unify";
4
4
 
5
- export default function unifyPremiseAgainstProofStep(premiseA, proofStepB, substitutions, localContextA, localContextB) {
5
+ export default function unifyPremiseWithProofStep(premiseA, proofStepB, substitutions, localContextA, localContextB) {
6
6
  let premiseUnified = false;
7
7
 
8
8
  const premiseAStatementNode = premiseA.getStatementNode();
@@ -20,12 +20,12 @@ export default function unifyPremiseAgainstProofStep(premiseA, proofStepB, subst
20
20
  if (subproofNodeB !== null) {
21
21
  const subproofStringB = subproofNodeAsSubproofString(subproofNodeB, localContextB);
22
22
 
23
- localContextB.trace(`Unifying the '${subproofStringB}' subproof against the premise's '${statementStringA}' statement...`, subproofNodeB);
23
+ localContextB.trace(`Unifying the '${subproofStringB}' subproof with the premise's '${statementStringA}' statement...`, subproofNodeB);
24
24
 
25
25
  const subproofUnified = premiseA.unifySubproof(subproofNodeB, substitutions, localContextA, localContextB);
26
26
 
27
27
  if (subproofUnified) {
28
- localContextB.debug(`...unified the '${subproofStringB}' subproof against the premise's '${statementStringA}' statement.`, subproofNodeB);
28
+ localContextB.debug(`...unified the '${subproofStringB}' subproof with the premise's '${statementStringA}' statement.`, subproofNodeB);
29
29
 
30
30
  premiseUnified = true;
31
31
  }
@@ -34,12 +34,12 @@ export default function unifyPremiseAgainstProofStep(premiseA, proofStepB, subst
34
34
  if (statementNodeB !== null) {
35
35
  const statementStringB = localContextB.nodeAsString(statementNodeB);
36
36
 
37
- localContextB.trace(`Unifying the '${statementStringB}' statement against the premise's '${statementStringA}' statement...`, statementNodeB);
37
+ localContextB.trace(`Unifying the '${statementStringB}' statement with the premise's '${statementStringA}' statement...`, statementNodeB);
38
38
 
39
39
  const statementUnified = premiseA.unifyStatement(statementNodeB, substitutions, localContextA, localContextB);
40
40
 
41
41
  if (statementUnified) {
42
- localContextB.debug(`...unified the '${statementStringB}' statement against the premise's '${statementStringA}' statement.`, statementNodeB);
42
+ localContextB.debug(`...unified the '${statementStringB}' statement with the premise's '${statementStringA}' statement.`, statementNodeB);
43
43
 
44
44
  premiseUnified = true;
45
45
  }
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  import LocalContext from "../context/local";
4
- import unifyPremiseAgainstProofStep from "../unify/premiseAgainstProofStep";
4
+ import unifyPremiseWithProofStep from "../unify/premiseWithProofStep";
5
5
 
6
6
  import { reverse, correlate } from "../utilities/array";
7
7
 
8
- export default function unifyPremisesAgainstProofSteps(premisesA, proofStepsB, substitutions, fileContextA, localContextB) {
8
+ export default function unifyPremisesWithProofSteps(premisesA, proofStepsB, substitutions, fileContextA, localContextB) {
9
9
  premisesA = reverse(premisesA); ///
10
10
 
11
11
  proofStepsB = reverse(proofStepsB); ///
12
12
 
13
13
  const premisesUnified = correlate(premisesA, proofStepsB, (premiseA, proofStepB) => {
14
14
  const localContextA = LocalContext.fromFileContext(fileContextA),
15
- premiseUnified = unifyPremiseAgainstProofStep(premiseA, proofStepB, substitutions, localContextA, localContextB);
15
+ premiseUnified = unifyPremiseWithProofStep(premiseA, proofStepB, substitutions, localContextA, localContextB);
16
16
 
17
17
  if (premiseUnified) {
18
18
  return true;
@@ -1,30 +1,30 @@
1
1
  "use strict";
2
2
 
3
+ import Substitutions from "../substitutions";
3
4
  import metaLevelUnifier from "../unifier/metaLevel";
4
5
  import TermForVariableSubstitution from "../substitution/termForVariable";
5
6
 
6
7
  import { push } from "../utilities/array";
7
8
 
8
- export default function unifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB) {
9
- let statementUnifiedAgainstStatement = false;
9
+ export default function unifyStatementWithStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB) {
10
+ let statementUnifiedWithStatement = false;
10
11
 
11
- const termForVariableSubstitution = TermForVariableSubstitution.fromSubstitutionAndSubstitutions(substitution, substitutions),
12
- transformed = termForVariableSubstitution.isTransformed(substitution);
12
+ const transformedSubstitutions = Substitutions.fromNothing(),
13
+ transformedSubstitution = substitution.transformed(substitutions);
13
14
 
14
- let substitutionsA = []; ///
15
-
16
- if (transformed) {
17
- const substitutionA = termForVariableSubstitution; ///
18
-
19
- substitutionsA.push(substitutionA);
15
+ if (transformedSubstitution !== null) {
16
+ transformedSubstitutions.addSubstitution(transformedSubstitution, localContextA, localContextB);
20
17
  }
21
18
 
22
19
  const nodeA = statementNodeA, ///
23
20
  nodeB = statementNodeB, ///
24
- unified = metaLevelUnifier.unify(nodeA, nodeB, substitutionsA, localContextA, localContextB);
21
+ unified = metaLevelUnifier.unify(nodeA, nodeB, transformedSubstitutions, localContextA, localContextB);
25
22
 
26
23
  if (unified) {
27
- if (!transformed) {
24
+ if (transformedSubstitution === null) {
25
+
26
+ debugger
27
+
28
28
  const substitutionB = termForVariableSubstitution, ///
29
29
  substitutionsB = [
30
30
  substitutionB
@@ -35,10 +35,10 @@ export default function unifyStatementAgainstStatement(statementNodeA, statement
35
35
  push(substitutions, substitutionsA);
36
36
  }
37
37
 
38
- statementUnifiedAgainstStatement = true;
38
+ statementUnifiedWithStatement = true;
39
39
  }
40
40
 
41
- return statementUnifiedAgainstStatement;
41
+ return statementUnifiedWithStatement;
42
42
  }
43
43
 
44
44
  function transformSubstitutions(substitutionsA, substitutionsB) {
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ import bracketedCombinator from "../ocmbinator/bracketed";
4
+ import statementWithCombinatorUnifier from "../unifier/statementWithCombinator";
5
+
6
+ export default function unifyStatementWithBracketedCombinator(statementNode, assignments, derived, localContext) {
7
+ let statementUnifiedWithBracketedCombinator;
8
+
9
+ const statementString = localContext.nodeAsString(statementNode);
10
+
11
+ localContext.trace(`Unifying the '${statementString}' statement with the bracketed combinator...`, statementNode);
12
+
13
+ const bracketedCombinatorStatementNode = bracketedCombinator.getStatementNode();
14
+
15
+ statementUnifiedWithBracketedCombinator = statementWithCombinatorUnifier.unify(statementNode, bracketedCombinatorStatementNode, assignments, derived, localContext);
16
+
17
+ if (statementUnifiedWithBracketedCombinator) {
18
+ localContext.debug(`...unified the '${statementString}' statement with the bracketed combinator.`, statementNode);
19
+ }
20
+
21
+ return statementUnifiedWithBracketedCombinator;
22
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ import statementWithCombinatorUnifier from "../unifier/statementWithCombinator";
4
+
5
+ export default function unifyStatementWithCombinators(statementNode, assignments, derived, localContext) {
6
+ let statementUnifiedWithCombinators;
7
+
8
+ const combinators = localContext.getCombinators();
9
+
10
+ statementUnifiedWithCombinators = combinators.some((combinator) => {
11
+ const statementUnifiedWithCombinator = unifyStatementWithCombinator(statementNode, combinator, assignments, derived, localContext);
12
+
13
+ if (statementUnifiedWithCombinator) {
14
+ return true;
15
+ }
16
+ });
17
+
18
+ return statementUnifiedWithCombinators;
19
+ }
20
+
21
+ function unifyStatementWithCombinator(statementNode, combinator, assignments, derived, localContext) {
22
+ let statementUnifiedWithCombinator;
23
+
24
+ const statementString = localContext.nodeAsString(statementNode),
25
+ combinatorString = combinator.getString();
26
+
27
+ localContext.trace(`Unifying the '${statementString}' statement with the '${combinatorString}' combinator...`, statementNode);
28
+
29
+ const combinatorStatementNode = combinator.getStatementNode();
30
+
31
+ statementUnifiedWithCombinator = statementWithCombinatorUnifier.unify(statementNode, combinatorStatementNode, assignments, derived, localContext);
32
+
33
+ if (statementUnifiedWithCombinator) {
34
+ localContext.debug(`...unified the '${statementString}' statement with the '${combinatorString}' combinator.`, statementNode);
35
+ }
36
+
37
+ return statementUnifiedWithCombinator;
38
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ import verifyStatementGivenMetaType from "../verify/statementGivenMetaType";
4
+
5
+ export default function unifyStatementWithMetaType(statementNode, metaTypeNode, assignments, derived, localContext) {
6
+ let statementUnifiedWithMetaType;
7
+
8
+ const metaType = localContext.findMetaTypeByMetaTypeNode(metaTypeNode),
9
+ statementVerifiedGivenMetaType = verifyStatementGivenMetaType(statementNode, metaType, assignments, derived, localContext);
10
+
11
+ statementUnifiedWithMetaType = statementVerifiedGivenMetaType; ///
12
+
13
+ return statementUnifiedWithMetaType;
14
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { subproofNodeAsSubproofString } from "../utilities/unify";
4
4
 
5
- export default function unifySuppositionAgainstProofStep(suppositionA, proofStepB, substitutions, localContextA, localContextB) {
5
+ export default function unifySuppositionWithProofStep(suppositionA, proofStepB, substitutions, localContextA, localContextB) {
6
6
  let suppositionUnified = false;
7
7
 
8
8
  const suppositionAStatementNode = suppositionA.getStatementNode();
@@ -20,12 +20,12 @@ export default function unifySuppositionAgainstProofStep(suppositionA, proofStep
20
20
  if (subproofNodeB !== null) {
21
21
  const subproofStringB = subproofNodeAsSubproofString(subproofNodeB, localContextB);
22
22
 
23
- localContextB.trace(`Unifying the '${subproofStringB}' subproof against the supposition's '${statementStringA}' statement...`, subproofNodeB);
23
+ localContextB.trace(`Unifying the '${subproofStringB}' subproof with the supposition's '${statementStringA}' statement...`, subproofNodeB);
24
24
 
25
25
  const subproofUnified = suppositionA.unifySubproof(subproofNodeB, substitutions, localContextA, localContextB);
26
26
 
27
27
  if (subproofUnified) {
28
- localContextB.debug(`...unified the '${subproofStringB}' subproof against the supposition's '${statementStringA}' statement.`, subproofNodeB);
28
+ localContextB.debug(`...unified the '${subproofStringB}' subproof with the supposition's '${statementStringA}' statement.`, subproofNodeB);
29
29
 
30
30
  suppositionUnified = true;
31
31
  }
@@ -34,12 +34,12 @@ export default function unifySuppositionAgainstProofStep(suppositionA, proofStep
34
34
  if (statementNodeB !== null) {
35
35
  const statementStringB = localContextB.nodeAsString(statementNodeB);
36
36
 
37
- localContextB.trace(`Unifying the '${statementStringB}' statement against the supposition's '${statementStringA}' statement...`, statementNodeB);
37
+ localContextB.trace(`Unifying the '${statementStringB}' statement with the supposition's '${statementStringA}' statement...`, statementNodeB);
38
38
 
39
39
  const statementUnified = suppositionA.unifyStatement(statementNodeB, substitutions, localContextA, localContextB);
40
40
 
41
41
  if (statementUnified) {
42
- localContextB.debug(`...unified the '${statementStringB}' statement against the supposition's '${statementStringA}' statement.`, statementNodeB);
42
+ localContextB.debug(`...unified the '${statementStringB}' statement with the supposition's '${statementStringA}' statement.`, statementNodeB);
43
43
 
44
44
  suppositionUnified = true;
45
45
  }
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  import LocalContext from "../context/local";
4
- import unifySuppositionAgainstProofStep from "./suppositionAgainstProofStep";
4
+ import unifySuppositionWithProofStep from "./suppositionWithProffStep";
5
5
 
6
6
  import { reverse, correlate } from "../utilities/array";
7
7
 
8
- export default function unifySuppositionsAgainstProofSteps(suppositionsA, proofStepsB, substitutions, fileContextA, localContextB) {
8
+ export default function unifySuppositionsWithProofSteps(suppositionsA, proofStepsB, substitutions, fileContextA, localContextB) {
9
9
  suppositionsA = reverse(suppositionsA); ///
10
10
 
11
11
  proofStepsB = reverse(proofStepsB); ///
12
12
 
13
13
  const suppositionsUnified = correlate(suppositionsA, proofStepsB, (suppositionA, proofStepB) => {
14
14
  const localContextA = LocalContext.fromFileContext(fileContextA),
15
- suppositionUnified = unifySuppositionAgainstProofStep(suppositionA, proofStepB, substitutions, localContextA, localContextB);
15
+ suppositionUnified = unifySuppositionWithProofStep(suppositionA, proofStepB, substitutions, localContextA, localContextB);
16
16
 
17
17
  if (suppositionUnified) {
18
18
  return true;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ import bracketedConstructor from "../constructor/bracketed";
4
+
5
+ import { nodeQuery } from "../utilities/query";
6
+
7
+ const termNodeQuery = nodeQuery("/term/argument/term");
8
+
9
+ export default function unifyTermWithBracketedConstructor(termNode, terms, localContext, verifyAhead) {
10
+ let termUnifiedWithBracketedConstructor;
11
+
12
+ const termString = localContext.nodeAsString(termNode),
13
+ bracketedTerms = [];
14
+
15
+ localContext.trace(`Unifying the '${termString}' term with the bracketed constructor...`, termNode);
16
+
17
+ termUnifiedWithBracketedConstructor = unifyTermWithConstructor(termNode, bracketedTerms, bracketedConstructor, localContext, () => {
18
+ let verifiedAhead;
19
+
20
+ const bracketedTermNode = termNode; ///
21
+
22
+ termNode = termNodeQuery(bracketedTermNode); ///
23
+
24
+ const termVVerified = verifyTerm(termNode, terms, localContext, verifyAhead);
25
+
26
+ verifiedAhead = termVVerified; ///
27
+
28
+ return verifiedAhead;
29
+ });
30
+
31
+ if (termUnifiedWithBracketedConstructor) {
32
+ localContext.debug(`...unified the '${termString}' term with the bracketed constructor.`, termNode);
33
+ }
34
+
35
+ return termUnifiedWithBracketedConstructor;
36
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ import Term from "../term";
4
+ import termWithConstructorUnifier from "../unifier/termWithConstructor";
5
+
6
+ import { nodeQuery } from "../utilities/query";
7
+
8
+ const variableNodeQuery = nodeQuery("/term/variable!");
9
+
10
+ export default function unifyTermWithConstructors(termNode, terms, localContext, verifyAhead) {
11
+ let termUnifiedWithConstructors = false;
12
+
13
+ const variableNode = variableNodeQuery(termNode);
14
+
15
+ if (variableNode === null) {
16
+ const constructors = localContext.getConstructors();
17
+
18
+ termUnifiedWithConstructors = constructors.some((constructor) => {
19
+ const termUnifiedWithConstructor = unifyTermWithConstructor(termNode, terms, constructor, localContext, verifyAhead);
20
+
21
+ if (termUnifiedWithConstructor) {
22
+ return true;
23
+ }
24
+ });
25
+ }
26
+
27
+ return termUnifiedWithConstructors;
28
+ }
29
+
30
+ function unifyTermWithConstructor(termNode, terms, constructor, localContext, verifyAhead) {
31
+ let termUnifiedWithConstructor = false;
32
+
33
+ const termString = localContext.nodeAsString(termNode),
34
+ constructorString = constructor.getString(),
35
+ constructorTermNode = constructor.getTermNode();
36
+
37
+ localContext.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`, termNode);
38
+
39
+ const termNodeA = termNode, ///
40
+ constructorTermNodeB = constructorTermNode, ///
41
+ unified = termWithConstructorUnifier.unify(termNodeA, constructorTermNodeB, localContext);
42
+
43
+ if (unified) {
44
+ let verifiedAhead;
45
+
46
+ const type = constructor.getType(),
47
+ term = Term.fromTermNodeAndType(termNode, type);
48
+
49
+ terms.push(term);
50
+
51
+ verifiedAhead = verifyAhead();
52
+
53
+ terms.pop();
54
+
55
+ termUnifiedWithConstructor = verifiedAhead; ///
56
+ }
57
+
58
+ if (termUnifiedWithConstructor) {
59
+ localContext.debug(`...unified the '${termString}' term with the '${constructorString}' constructor.`, termNode);
60
+ }
61
+
62
+ return termUnifiedWithConstructor;
63
+ }