occam-verify-cli 0.0.958 → 0.0.960

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 (132) hide show
  1. package/bin/action/verify.js +16 -5
  2. package/bin/utilities/releaseContext.js +5 -8
  3. package/lib/axiom.js +1 -7
  4. package/lib/combinator.js +1 -19
  5. package/lib/conclusion.js +1 -19
  6. package/lib/conjecture.js +1 -7
  7. package/lib/consequent.js +1 -19
  8. package/lib/constructor.js +1 -28
  9. package/lib/context/file.js +38 -14
  10. package/lib/context/local.js +1 -14
  11. package/lib/context/release.js +82 -52
  12. package/lib/frame.js +3 -3
  13. package/lib/index.js +5 -5
  14. package/lib/label.js +1 -16
  15. package/lib/lemma.js +1 -7
  16. package/lib/metaLemma.js +1 -7
  17. package/lib/metaType.js +1 -10
  18. package/lib/metatheorem.js +1 -7
  19. package/lib/metavariable.js +9 -34
  20. package/lib/premise.js +1 -18
  21. package/lib/proofStep.js +15 -15
  22. package/lib/releaseContext/create.js +8 -9
  23. package/lib/releaseContext/initialise.js +67 -0
  24. package/lib/rule.js +5 -49
  25. package/lib/ruleNames.js +1 -9
  26. package/lib/substitution/statementForMetavariable.js +8 -16
  27. package/lib/substitution/termForVariable.js +6 -6
  28. package/lib/substitution.js +7 -7
  29. package/lib/substitutions.js +7 -33
  30. package/lib/supposition.js +1 -18
  31. package/lib/theorem.js +1 -7
  32. package/lib/topLevelAssertion.js +5 -50
  33. package/lib/type.js +2 -38
  34. package/lib/unifier/equality.js +7 -7
  35. package/lib/unifier/intrinsicLevel.js +4 -4
  36. package/lib/unifier/metaLevel.js +10 -10
  37. package/lib/unifier/statementWithCombinator.js +147 -0
  38. package/lib/unifier/{termAgainstConstructor.js → termWithConstructor.js} +17 -17
  39. package/lib/unify/conclusionWithStatement.js +34 -0
  40. package/lib/unify/consequentWithStatement.js +34 -0
  41. package/lib/unify/metavariableWithStatement.js +74 -0
  42. package/lib/unify/premiseWithProofStep.js +41 -0
  43. package/lib/unify/premisesWithProofSteps.js +31 -0
  44. package/lib/unify/statementAtainstStatement.js +6 -6
  45. package/lib/unify/statementWithMetaType.js +48 -0
  46. package/lib/unify/suppositionWithProffStep.js +41 -0
  47. package/lib/unify/suppositionsWithProofSteps.js +31 -0
  48. package/lib/unify/termWithTerm.js +21 -0
  49. package/lib/unify/termWithType.js +32 -0
  50. package/lib/unify/variableWithTerm.js +54 -0
  51. package/lib/utilities/node.js +3 -42
  52. package/lib/utilities/tokens.js +1 -15
  53. package/lib/variable.js +1 -26
  54. package/lib/verify/error.js +2 -2
  55. package/lib/verify/judgement.js +3 -3
  56. package/lib/verify/metavariable.js +4 -4
  57. package/lib/verify/statement/qualified.js +51 -51
  58. package/lib/verify/statement.js +18 -18
  59. package/lib/verify/statementAsCombinator.js +2 -2
  60. package/lib/verify/term.js +25 -25
  61. package/package.json +1 -1
  62. package/src/axiom.js +0 -2
  63. package/src/combinator.js +0 -26
  64. package/src/conclusion.js +0 -24
  65. package/src/conjecture.js +0 -2
  66. package/src/consequent.js +0 -24
  67. package/src/constructor.js +0 -43
  68. package/src/context/file.js +42 -17
  69. package/src/context/local.js +0 -22
  70. package/src/context/release.js +84 -45
  71. package/src/frame.js +2 -2
  72. package/src/index.js +1 -1
  73. package/src/label.js +0 -18
  74. package/src/lemma.js +0 -2
  75. package/src/metaLemma.js +0 -2
  76. package/src/metaType.js +0 -9
  77. package/src/metatheorem.js +0 -2
  78. package/src/metavariable.js +6 -44
  79. package/src/premise.js +0 -22
  80. package/src/proofStep.js +14 -14
  81. package/src/releaseContext/create.js +8 -16
  82. package/src/releaseContext/{verify.js → initialise.js} +32 -23
  83. package/src/rule.js +4 -69
  84. package/src/ruleNames.js +0 -2
  85. package/src/substitution/statementForMetavariable.js +7 -21
  86. package/src/substitution/termForVariable.js +4 -4
  87. package/src/substitution.js +5 -5
  88. package/src/substitutions.js +5 -32
  89. package/src/supposition.js +0 -22
  90. package/src/theorem.js +0 -2
  91. package/src/topLevelAssertion.js +4 -72
  92. package/src/type.js +0 -44
  93. package/src/unifier/equality.js +6 -6
  94. package/src/unifier/intrinsicLevel.js +3 -3
  95. package/src/unifier/metaLevel.js +9 -9
  96. package/src/unifier/{statementAgainstCombinator.js → statementWithCombinator.js} +12 -12
  97. package/src/unifier/{termAgainstConstructor.js → termWithConstructor.js} +9 -9
  98. package/src/unify/{conclusionAgainstStatement.js → conclusionWithStatement.js} +3 -3
  99. package/src/unify/{consequentAgainstStatement.js → consequentWithStatement.js} +3 -3
  100. package/src/unify/{metavariableAgainstStatement.js → metavariableWithStatement.js} +12 -12
  101. package/src/unify/{premiseAgainstProofStep.js → premiseWithProofStep.js} +5 -5
  102. package/src/unify/{premisesAgainstProofSteps.js → premisesWithProofSteps.js} +3 -3
  103. package/src/unify/statementAtainstStatement.js +4 -4
  104. package/src/unify/{statementAgainstMetaType.js → statementWithMetaType.js} +5 -5
  105. package/src/unify/{suppositionAgainstProofStep.js → suppositionWithProffStep.js} +5 -5
  106. package/src/unify/{suppositionsAgainstProofSteps.js → suppositionsWithProofSteps.js} +3 -3
  107. package/src/unify/{termAgainstTerm.js → termWithTerm.js} +4 -4
  108. package/src/unify/{termAgainstType.js → termWithType.js} +4 -4
  109. package/src/unify/{variableAgainstTerm.js → variableWithTerm.js} +5 -5
  110. package/src/utilities/node.js +2 -48
  111. package/src/utilities/tokens.js +0 -15
  112. package/src/variable.js +0 -36
  113. package/src/verify/error.js +1 -1
  114. package/src/verify/judgement.js +3 -3
  115. package/src/verify/metavariable.js +3 -3
  116. package/src/verify/statement/qualified.js +50 -50
  117. package/src/verify/statement.js +17 -17
  118. package/src/verify/statementAsCombinator.js +1 -1
  119. package/src/verify/term.js +24 -24
  120. package/lib/releaseContext/verify.js +0 -66
  121. package/lib/unifier/statementAgainstCombinator.js +0 -147
  122. package/lib/unify/conclusionAgainstStatement.js +0 -34
  123. package/lib/unify/consequentAgainstStatement.js +0 -34
  124. package/lib/unify/metavariableAgainstStatement.js +0 -74
  125. package/lib/unify/premiseAgainstProofStep.js +0 -41
  126. package/lib/unify/premisesAgainstProofSteps.js +0 -31
  127. package/lib/unify/statementAgainstMetaType.js +0 -48
  128. package/lib/unify/suppositionAgainstProofStep.js +0 -41
  129. package/lib/unify/suppositionsAgainstProofSteps.js +0 -31
  130. package/lib/unify/termAgainstTerm.js +0 -21
  131. package/lib/unify/termAgainstType.js +0 -32
  132. package/lib/unify/variableAgainstTerm.js +0 -54
@@ -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,11 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import Label from "./label";
4
- import Premise from "./premise";
5
- import Conclusion from "./conclusion";
6
3
  import Substitutions from "./substitutions";
7
- import unifyPremisesAgainstProofSteps from "./unify/premisesAgainstProofSteps";
8
- import unifyConclusionAgainstStatement from "./unify/conclusionAgainstStatement";
4
+ import unifyPremisesWithProofSteps from "./unify/premisesWithProofSteps";
5
+ import unifyConclusionWithStatement from "./unify/conclusionWithStatement";
9
6
 
10
7
  export default class Rule {
11
8
  constructor(labels, premises, conclusion, fileContext) {
@@ -40,11 +37,11 @@ export default class Rule {
40
37
  proofStepsB = proofSteps, ///
41
38
  fileContextA = this.fileContext, ///
42
39
  localContextB = localContext, ///
43
- premisesUnified = unifyPremisesAgainstProofSteps(premisesA, proofStepsB, substitutions, fileContextA, localContextB);
40
+ premisesUnified = unifyPremisesWithProofSteps(premisesA, proofStepsB, substitutions, fileContextA, localContextB);
44
41
 
45
42
  if (premisesUnified) {
46
43
  const conclusionA = this.conclusion, ///
47
- conclusionUnified = unifyConclusionAgainstStatement(conclusionA, statementNode, substitutions, fileContextA, localContextB);
44
+ conclusionUnified = unifyConclusionWithStatement(conclusionA, statementNode, substitutions, fileContextA, localContextB);
48
45
 
49
46
  statementUnified = conclusionUnified; ///
50
47
  }
@@ -64,68 +61,6 @@ export default class Rule {
64
61
  return matchesMetavariableNode;
65
62
  }
66
63
 
67
- toJSON(tokens) {
68
- const labelsJSON = this.labels.map((label) => {
69
- const labelJSON = label.toJSON(tokens);
70
-
71
- return labelJSON;
72
- }),
73
- premisesJSON = this.premises.map((premise) => {
74
- const premiseJSON = premise.toJSON(tokens);
75
-
76
- return premiseJSON;
77
- }),
78
- conclusionJSON = this.conclusion.toJSON(tokens),
79
- labels = labelsJSON, ///
80
- premises = premisesJSON, ///
81
- conclusion = conclusionJSON, ///
82
- json = {
83
- labels,
84
- premises,
85
- conclusion
86
- };
87
-
88
- return json;
89
- }
90
-
91
- static fromJSONAndFileContext(json, fileContext) {
92
- let rule;
93
-
94
- let { labels } = json;
95
-
96
- const labelsJSON = labels; ///
97
-
98
- labels = labelsJSON.map((labelJSON) => {
99
- const json = labelJSON, ///
100
- label = Label.fromJSONAndFileContext(json, fileContext);
101
-
102
- return label;
103
- });
104
-
105
- let { premises } = json;
106
-
107
- const premisesJSON = premises; ///
108
-
109
- premises = premisesJSON.map((premiseJSON) => {
110
- const json = premiseJSON, ///
111
- premise = Premise.fromJSONAndFileContext(json, fileContext);
112
-
113
- return premise;
114
- });
115
-
116
- let { conclusion } = json;
117
-
118
- const conclusionJSON = conclusion; ///
119
-
120
- json = conclusionJSON; ///
121
-
122
- conclusion = Conclusion.fromJSONAndFileContext(json, fileContext);
123
-
124
- rule = new Rule(labels, premises, conclusion, fileContext);
125
-
126
- return rule;
127
- }
128
-
129
64
  static fromLabelsPremisesConclusionAndFileContext(labels, premises, conclusion, fileContext) {
130
65
  const rule = new Rule(labels, premises, conclusion, fileContext);
131
66
 
package/src/ruleNames.js CHANGED
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
2
 
3
- export const METAVARIABLE_RULE_NAME = "metavariable";
4
- export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
5
3
  export const UNQUALIFIED_STATEMENT_RULE_NAME = "unqualifiedStatement";
6
4
  export const CONSTRUCTOR_DECLARATION_RULE_NAME = "constructorDeclaration";
@@ -3,10 +3,9 @@
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
- import { statementNodeFromStatementString, metavariableNodeFromMetavariableString } from "../utilities/node";
10
9
  import { matchStatementModuloBrackets, bracketedStatementChildNodeFromStatementNode } from "../utilities/match";
11
10
 
12
11
  const metavariableNodeQuery = nodeQuery("/statement/metavariable!");
@@ -75,8 +74,8 @@ export default class StatementForMetavariableSubstitution extends Substitution {
75
74
  return statementNodeMatches;
76
75
  }
77
76
 
78
- unifyAgainstEquivalence(equivalence, substitutions, localContextA, localContextB) {
79
- let unifiedAgainstEquivalence = false; ///
77
+ unifyWithEquivalence(equivalence, substitutions, localContextA, localContextB) {
78
+ let unifiedWithEquivalence = false; ///
80
79
 
81
80
  const metavariableNode = metavariableNodeQuery(this.statementNode);
82
81
 
@@ -90,10 +89,10 @@ export default class StatementForMetavariableSubstitution extends Substitution {
90
89
  nodeB = metavariableNode, ///
91
90
  unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
92
91
 
93
- unifiedAgainstEquivalence = unified; ///
92
+ unifiedWithEquivalence = unified; ///
94
93
  }
95
94
 
96
- return unifiedAgainstEquivalence;
95
+ return unifiedWithEquivalence;
97
96
  }
98
97
 
99
98
  asString(localContextA, localContextB) {
@@ -106,19 +105,6 @@ export default class StatementForMetavariableSubstitution extends Substitution {
106
105
  return string;
107
106
  }
108
107
 
109
- static fromJSONAndFileContext(json, fileContext) {
110
- const { metavariable, statement } = json,
111
- metavariableString = metavariable, ///
112
- statementString = statement, ///
113
- lexer = fileContext.getLexer(),
114
- parser = fileContext.getParser(),
115
- statementNode = statementNodeFromStatementString(statementString, lexer, parser),
116
- metavariableNode = metavariableNodeFromMetavariableString(metavariableString, lexer, parser),
117
- statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(statementNode, metavariableNode);
118
-
119
- return statementForMetavariableSubstitution;
120
- }
121
-
122
108
  static fromMetavariableNodeAndStatementNode(metavariableNode, statementNode) {
123
109
  let statementForMetavariableSubstitution;
124
110
 
@@ -170,9 +156,9 @@ function unifyStatement(statementNodeA, statementNodeB, substitution, substituti
170
156
 
171
157
  statementUnified = statementNodeAMatchesStatementNodeB; ///
172
158
  } else {
173
- const statementUnifiedAgainstStatement = unifyStatementAgainstStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
159
+ const statementUnifiedWithStatement = unifyStatementWithStatement(statementNodeA, statementNodeB, substitution, substitutions, localContextA, localContextB);
174
160
 
175
- statementUnified = statementUnifiedAgainstStatement; ///
161
+ statementUnified = statementUnifiedWithStatement; ///
176
162
  }
177
163
 
178
164
  return statementUnified;
@@ -51,8 +51,8 @@ export default class TermForVariableSubstitution extends Substitution {
51
51
  return matchesVariableNode;
52
52
  }
53
53
 
54
- unifyAgainstEquivalence(equivalence, substitutions, localContextA, localContextB) {
55
- let unifiedAgainstEquivalence;
54
+ unifyWithEquivalence(equivalence, substitutions, localContextA, localContextB) {
55
+ let unifiedWithEquivalence;
56
56
 
57
57
  const equivalenceMatchesVariableNode = equivalence.matchVariableNode(this.variableNode);
58
58
 
@@ -60,11 +60,11 @@ export default class TermForVariableSubstitution extends Substitution {
60
60
  const equivalenceMatchesTermNode = equivalence.matchTermNode(this.termNode);
61
61
 
62
62
  if (equivalenceMatchesTermNode) {
63
- unifiedAgainstEquivalence = true;
63
+ unifiedWithEquivalence = true;
64
64
  }
65
65
  }
66
66
 
67
- return unifiedAgainstEquivalence;
67
+ return unifiedWithEquivalence;
68
68
  }
69
69
 
70
70
  asString(localContextA, localContextB) {
@@ -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
  }
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import StatementForMetavariableSubstitution from "./substitution/statementForMetavariable";
4
-
5
3
  import { prune, compare, rightDifference } from "./utilities/array";
6
4
 
7
5
  export default class Substitutions {
@@ -57,17 +55,17 @@ export default class Substitutions {
57
55
  localContextB.trace(`Removed the '${substitutionString}' substitution.`, substitutionNode);
58
56
  }
59
57
 
60
- unifyAgainstEquivalences(equivalences, localContextA, localContextB) {
61
- const unifiedAgainstEquivalences = this.everySubstitution((substitution) => {
58
+ unifyWithEquivalences(equivalences, localContextA, localContextB) {
59
+ const unifiedWithEquivalences = this.everySubstitution((substitution) => {
62
60
  const substitutions = this, ///
63
- substitutionUnifiedAgainstEquivalence = substitution.unifyAgainstEquivalences(equivalences, substitutions, localContextA, localContextB);
61
+ substitutionUnifiedWithEquivalence = substitution.unifyWithEquivalences(equivalences, substitutions, localContextA, localContextB);
64
62
 
65
- if (substitutionUnifiedAgainstEquivalence) {
63
+ if (substitutionUnifiedWithEquivalence) {
66
64
  return true;
67
65
  }
68
66
  });
69
67
 
70
- return unifiedAgainstEquivalences;
68
+ return unifiedWithEquivalences;
71
69
  }
72
70
 
73
71
  snapshot() {
@@ -102,16 +100,6 @@ export default class Substitutions {
102
100
  ///
103
101
  }
104
102
 
105
- toJSON(tokens) {
106
- const json = this.array.map((substitution) => {
107
- const substitutionJSON = substitution.toJSON(tokens);
108
-
109
- return substitutionJSON;
110
- });
111
-
112
- return json;
113
- }
114
-
115
103
  static fromNothing() {
116
104
  const array = [],
117
105
  savedArray = null,
@@ -119,19 +107,4 @@ export default class Substitutions {
119
107
 
120
108
  return substitutions;
121
109
  }
122
-
123
- static fromJSONAndFileContext(json, fileContext) {
124
- const substitutionsJSON = json, ///
125
- array = substitutionsJSON.map((substitutionJSON) => {
126
- const json = substitutionJSON, ///
127
- statementForMetavariableSubstitution = StatementForMetavariableSubstitution.fromJSONAndFileContext(json, fileContext),
128
- substitution = statementForMetavariableSubstitution; ///
129
-
130
- return substitution;
131
- }),
132
- savedArray = null,
133
- substitutions = new Substitutions(array, savedArray);
134
-
135
- return substitutions;
136
- }
137
110
  }
@@ -5,7 +5,6 @@ import metaLevelUnifier from "./unifier/metaLevel";
5
5
  import { match } from "./utilities/array";
6
6
  import { nodeAsString } from "./utilities/string";
7
7
  import { nodeQuery, nodesQuery } from "./utilities/query";
8
- import { statementNodeFromStatementString } from "./utilities/node";
9
8
 
10
9
  const subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion!"),
11
10
  subproofAssertionStatementNodesQuery = nodesQuery("/subproofAssertion/statement"),
@@ -66,30 +65,9 @@ export default class Supposition {
66
65
  return subproofUnified;
67
66
  }
68
67
 
69
- toJSON(tokens) {
70
- const statementString = nodeAsString(this.statementNode, tokens),
71
- statement = statementString, ///
72
- json = {
73
- statement
74
- };
75
-
76
- return json;
77
- }
78
-
79
68
  static fromStatementNode(statementNode) {
80
69
  const supposition = new Supposition(statementNode);
81
70
 
82
71
  return supposition;
83
72
  }
84
-
85
- static fromJSONAndFileContext(json, fileContext) {
86
- const { statement } = json,
87
- statementString = statement, ///
88
- lexer = fileContext.getLexer(),
89
- parser = fileContext.getParser(),
90
- statementNode = statementNodeFromStatementString(statementString, lexer, parser),
91
- supposition = new Supposition(statementNode);
92
-
93
- return supposition;
94
- }
95
73
  }
package/src/theorem.js CHANGED
@@ -3,7 +3,5 @@
3
3
  import TopLevelAssertion from "./topLevelAssertion";
4
4
 
5
5
  export default class Theorem extends TopLevelAssertion {
6
- static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Theorem, json, fileContext); }
7
-
8
6
  static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Theorem, labels, suppositions, consequent, substitutions, fileContext); }
9
7
  }
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import Label from "./label";
4
- import Consequent from "./consequent";
5
- import Supposition from "./supposition";
6
3
  import Substitutions from "./substitutions";
7
- import unifyConsequentAgainstStatement from "./unify/consequentAgainstStatement";
8
- import unifySuppositionsAgainstProofSteps from "./unify/suppositionsAgainstProofSteps";
4
+ import unifyConsequentWithStatement from "./unify/consequentWithStatement";
5
+ import unifySuppositionsWithProofSteps from "./unify/suppositionsWithProofSteps";
9
6
 
10
7
  export default class TopLevelAssertion {
11
8
  constructor(labels, suppositions, consequent, substitutions, fileContext) {
@@ -45,11 +42,11 @@ export default class TopLevelAssertion {
45
42
  fileContextA = this.fileContext, ///
46
43
  suppositionsA = this.suppositions, ///
47
44
  localContextB = localContext, ///
48
- suppositionsUnified = unifySuppositionsAgainstProofSteps(suppositionsA, proofStepsB, substitutions, fileContextA, localContextB);
45
+ suppositionsUnified = unifySuppositionsWithProofSteps(suppositionsA, proofStepsB, substitutions, fileContextA, localContextB);
49
46
 
50
47
  if (suppositionsUnified) {
51
48
  const consequentA = this.consequent, ///
52
- consequentUnified = unifyConsequentAgainstStatement(consequentA, statementNode, substitutions, fileContextA, localContext);
49
+ consequentUnified = unifyConsequentWithStatement(consequentA, statementNode, substitutions, fileContextA, localContext);
53
50
 
54
51
  statementUnified = consequentUnified; ///
55
52
  }
@@ -69,70 +66,5 @@ export default class TopLevelAssertion {
69
66
  return matchesMetavariableNode;
70
67
  }
71
68
 
72
- toJSON(tokens) {
73
- const labelsJSON = this.labels.map((label) => {
74
- const labelJSON = label.toJSON(tokens);
75
-
76
- return labelJSON;
77
- }),
78
- suppositionsJSON = this.suppositions.map((supposition) => {
79
- const suppositionJSON = supposition.toJSON(tokens);
80
-
81
- return suppositionJSON;
82
- }),
83
- consequentJSON = this.consequent.toJSON(tokens),
84
- substitutionsJSON = this.substitutions.toJSON(tokens),
85
- labels = labelsJSON, ///
86
- suppositions = suppositionsJSON, ///
87
- consequent = consequentJSON, ///
88
- substitutions = substitutionsJSON, ///
89
- json = {
90
- labels,
91
- suppositions,
92
- consequent,
93
- substitutions
94
- };
95
-
96
- return json;
97
- }
98
-
99
- static fromJSONAndFileContext(Class, json, fileContext) {
100
- let { labels } = json;
101
-
102
- const labelsJSON = labels; ///
103
-
104
- labels = labelsJSON.map((labelJSON) => {
105
- const json = labelJSON, ///
106
- label = Label.fromJSONAndFileContext(json, fileContext);
107
-
108
- return label;
109
- });
110
-
111
- let { suppositions, consequent, substitutions } = json;
112
-
113
- const suppositionsJSON = suppositions; ///
114
-
115
- suppositions = suppositionsJSON.map((suppositionJSON) => {
116
- const json = suppositionJSON, ///
117
- supposition = Supposition.fromJSONAndFileContext(json, fileContext);
118
-
119
- return supposition;
120
- });
121
-
122
- const consequentJSON = consequent; ///
123
-
124
- json = consequentJSON; ///
125
-
126
- consequent = Consequent.fromJSONAndFileContext(json, fileContext);
127
-
128
- const substitutionsJSON = substitutions; ///
129
-
130
- json = substitutionsJSON; ///
131
-
132
- substitutions = Substitutions.fromJSONAndFileContext(json, fileContext);
133
-
134
- return new Class(labels, suppositions, consequent, substitutions, fileContext); ///
135
- }
136
-
137
69
  static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Class, labels, suppositions, consequent, substitutions, fileContext) { return new Class(labels, suppositions, consequent, substitutions, fileContext); }
138
70
  }
package/src/type.js CHANGED
@@ -125,18 +125,6 @@ export default class Type {
125
125
  return string;
126
126
  }
127
127
 
128
- toJSON(tokens) {
129
- const superTypeJSON = this.superType.toJSON(tokens),
130
- name = this.name,
131
- superType = superTypeJSON, ///
132
- json = {
133
- name,
134
- superType
135
- };
136
-
137
- return json;
138
- }
139
-
140
128
  static fromTypeName(typeName) {
141
129
  const name = typeName, ///
142
130
  superType = objectType, ///
@@ -154,17 +142,6 @@ export default class Type {
154
142
  }
155
143
 
156
144
  class ObjectType extends Type {
157
- toJSON(tokens) {
158
- const name = this.name,
159
- superType = null, ///
160
- json = {
161
- name,
162
- superType
163
- };
164
-
165
- return json;
166
- }
167
-
168
145
  static fromNothing() {
169
146
  const name = OBJECT_TYPE_NAME,
170
147
  superType = null,
@@ -175,24 +152,3 @@ class ObjectType extends Type {
175
152
  }
176
153
 
177
154
  export const objectType = ObjectType.fromNothing();
178
-
179
- export function typeFromJSONAndFileContext(json, fileContext) {
180
- let type;
181
-
182
- const { name } = json,
183
- typeName = name; ///
184
-
185
- type = fileContext.findTypeByTypeName(typeName);
186
-
187
- if (type === null) {
188
- let { superType } = json;
189
-
190
- const superJSON = superType; ///
191
-
192
- superType = typeFromJSONAndFileContext(superJSON, fileContext);
193
-
194
- type = new Type(name, superType);
195
- }
196
-
197
- return type;
198
- }
@@ -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
  ];