occam-verify-cli 0.0.923 → 0.0.924

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 (74) hide show
  1. package/lib/axiom.js +9 -9
  2. package/lib/conjecture.js +9 -9
  3. package/lib/constants.js +1 -9
  4. package/lib/context/file.js +3 -3
  5. package/lib/context/local.js +5 -5
  6. package/lib/lemma.js +9 -9
  7. package/lib/metaLemma.js +7 -7
  8. package/lib/metatheorem.js +7 -7
  9. package/lib/metavariable.js +8 -1
  10. package/lib/theorem.js +9 -9
  11. package/lib/topLevelAssertion.js +186 -0
  12. package/lib/verify/axiom.js +4 -4
  13. package/lib/verify/conjecture.js +4 -4
  14. package/lib/verify/containedAssertion.js +91 -0
  15. package/lib/verify/declaration.js +2 -2
  16. package/lib/verify/definedAssertion.js +115 -0
  17. package/lib/verify/derivation.js +7 -7
  18. package/lib/verify/frame.js +2 -2
  19. package/lib/verify/judgement.js +2 -2
  20. package/lib/verify/lemma.js +5 -5
  21. package/lib/verify/metaLemma.js +4 -4
  22. package/lib/verify/metastatement.js +4 -23
  23. package/lib/verify/metatheorem.js +4 -4
  24. package/lib/verify/metavariable.js +2 -2
  25. package/lib/verify/proof.js +3 -3
  26. package/lib/verify/proofStep.js +4 -4
  27. package/lib/verify/rule.js +3 -3
  28. package/lib/verify/statement/qualified.js +18 -21
  29. package/lib/verify/statement/unqualified.js +38 -10
  30. package/lib/verify/statement.js +85 -92
  31. package/lib/verify/subDerivation.js +3 -3
  32. package/lib/verify/subproof.js +3 -3
  33. package/lib/verify/termAsConstructor.js +2 -2
  34. package/lib/verify/theorem.js +4 -4
  35. package/package.json +2 -2
  36. package/src/axiom.js +4 -4
  37. package/src/conjecture.js +4 -4
  38. package/src/constants.js +0 -2
  39. package/src/context/file.js +2 -2
  40. package/src/context/local.js +4 -3
  41. package/src/lemma.js +4 -4
  42. package/src/metaLemma.js +4 -4
  43. package/src/metatheorem.js +4 -4
  44. package/src/metavariable.js +6 -0
  45. package/src/theorem.js +4 -4
  46. package/src/{metaLemmaMetatheorem.js → topLevelAssertion.js} +16 -26
  47. package/src/verify/axiom.js +5 -4
  48. package/src/verify/conjecture.js +5 -4
  49. package/src/verify/{statementAsContainedAssertion.js → containedAssertion.js} +20 -36
  50. package/src/verify/declaration.js +1 -1
  51. package/src/verify/{statementAsDefinedAssertion.js → definedAssertion.js} +22 -37
  52. package/src/verify/derivation.js +6 -6
  53. package/src/verify/frame.js +1 -1
  54. package/src/verify/judgement.js +1 -1
  55. package/src/verify/lemma.js +8 -5
  56. package/src/verify/metaLemma.js +4 -4
  57. package/src/verify/metastatement.js +3 -31
  58. package/src/verify/metatheorem.js +4 -4
  59. package/src/verify/metavariable.js +1 -1
  60. package/src/verify/proof.js +2 -2
  61. package/src/verify/proofStep.js +3 -3
  62. package/src/verify/rule.js +4 -4
  63. package/src/verify/statement/qualified.js +33 -32
  64. package/src/verify/statement/unqualified.js +52 -10
  65. package/src/verify/statement.js +133 -39
  66. package/src/verify/subDerivation.js +2 -2
  67. package/src/verify/subproof.js +2 -2
  68. package/src/verify/termAsConstructor.js +2 -2
  69. package/src/verify/theorem.js +7 -4
  70. package/lib/axiomLemmaTheoremConjecture.js +0 -174
  71. package/lib/metaLemmaMetatheorem.js +0 -191
  72. package/lib/verify/statementAsContainedAssertion.js +0 -109
  73. package/lib/verify/statementAsDefinedAssertion.js +0 -132
  74. package/src/axiomLemmaTheoremConjecture.js +0 -165
@@ -305,8 +305,8 @@ class LocalContext {
305
305
  return judgementPresent;
306
306
  }
307
307
 
308
- isMetavariablePresentByMetavariableNode(metavariableNode, localContext) {
309
- const metavariable = this.findMetavariableByMetavariableNode(metavariableNode, localContext),
308
+ isMetavariablePresentByMetavariableNode(metavariableNode) {
309
+ const metavariable = this.findMetavariableByMetavariableNode(metavariableNode),
310
310
  metavariablePresent = (metavariable !== null);
311
311
 
312
312
  return metavariablePresent;
@@ -339,8 +339,9 @@ class LocalContext {
339
339
  return judgement;
340
340
  }
341
341
 
342
- findMetavariableByMetavariableNode(metavariableNode, localContext) {
342
+ findMetavariableByMetavariableNode(metavariableNode) {
343
343
  const node = metavariableNode, ///
344
+ localContext = this, ///
344
345
  metavariables = this.getMetavariables(),
345
346
  metavariable = metavariables.find((metavariable) => {
346
347
  const matches = metavariable.matchNode(node, localContext);
package/src/lemma.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
3
+ import TopLevelAssertion from "./topLevelAssertion";
4
4
 
5
- export default class Lemma extends AxiomLemmaTheoremConjecture {
6
- static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Lemma,json, fileContext); }
5
+ export default class Lemma extends TopLevelAssertion {
6
+ static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Lemma,json, fileContext); }
7
7
 
8
- static fromLabelsSuppositionsConsequentAndLocalContext(labels, suppositions, consequent, localContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequentAndLocalContext(Lemma, labels, suppositions, consequent, localContext); }
8
+ static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Lemma, labels, suppositions, consequent, substitutions, fileContext); }
9
9
  }
package/src/metaLemma.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- import MetalemmaMetatheorem from "./metalemmaMetatheorem";
3
+ import TopLevelAssertion from "./topLevelAssertion";
4
4
 
5
- export default class MetaLemma extends MetalemmaMetatheorem {
6
- static fromJSONAndFileContext(json, fileContext) { return MetalemmaMetatheorem.fromJSONAndFileContext(MetaLemma, json, fileContext); }
5
+ export default class MetaLemma extends TopLevelAssertion {
6
+ static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(MetaLemma, json, fileContext); }
7
7
 
8
- static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, metaSuppositions, metaConsequent, substitutions, fileContext) { return MetalemmaMetatheorem.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(MetaLemma, labels, metaSuppositions, metaConsequent, substitutions, fileContext); }
8
+ static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, metaSuppositions, metaConsequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(MetaLemma, labels, metaSuppositions, metaConsequent, substitutions, fileContext); }
9
9
  }
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- import MetaLemmaMetatheorem from "./metaLemmaMetatheorem";
3
+ import TopLevelAssertion from "./topLevelAssertion";
4
4
 
5
- export default class Metatheorem extends MetaLemmaMetatheorem {
6
- static fromJSONAndFileContext(json, fileContext) { return MetaLemmaMetatheorem.fromJSONAndFileContext(Metatheorem, json, fileContext); }
5
+ export default class Metatheorem extends TopLevelAssertion {
6
+ static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Metatheorem, json, fileContext); }
7
7
 
8
- static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, fileContext) { return MetaLemmaMetatheorem.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(Metatheorem, labels, suppositions, consequent, fileContext); }
8
+ static fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, fileContext) { return TopLevelAssertion.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(Metatheorem, labels, suppositions, consequent, fileContext); }
9
9
  }
@@ -36,6 +36,12 @@ export default class Metavariable {
36
36
  return this.metaType;
37
37
  }
38
38
 
39
+ getMetaTypeName() {
40
+ const metaTypeName = this.metaType.getName();
41
+
42
+ return metaTypeName;
43
+ }
44
+
39
45
  matchName(name) {
40
46
  const matchesName = (this.name === name);
41
47
 
package/src/theorem.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
3
+ import TopLevelAssertion from "./topLevelAssertion";
4
4
 
5
- export default class Theorem extends AxiomLemmaTheoremConjecture {
6
- static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Theorem, json, fileContext); }
5
+ export default class Theorem extends TopLevelAssertion {
6
+ static fromJSONAndFileContext(json, fileContext) { return TopLevelAssertion.fromJSONAndFileContext(Theorem, json, fileContext); }
7
7
 
8
- static fromLabelsSuppositionsConsequentAndLocalContext(labels, suppositions, consequent, localContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequentAndLocalContext(Theorem, labels, suppositions, consequent, localContext); }
8
+ static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext) { return TopLevelAssertion.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Theorem, labels, suppositions, consequent, substitutions, fileContext); }
9
9
  }
@@ -7,7 +7,7 @@ import StatementForMetavariableSubstitution from "./substitution/statementForMet
7
7
 
8
8
  import { reverse, correlate } from "./utilities/array";
9
9
 
10
- export default class MetaLemmaMetatheorem {
10
+ export default class TopLevelAssertion {
11
11
  constructor(labels, suppositions, consequent, substitutions, fileContext) {
12
12
  this.labels = labels;
13
13
  this.suppositions = suppositions;
@@ -39,9 +39,9 @@ export default class MetaLemmaMetatheorem {
39
39
  matchStatement(statementNode, localContext) {
40
40
  let statementNatches = false;
41
41
 
42
- const metaproofSteps = localContext.getProofSteps(),
42
+ const proofSteps = localContext.getProofSteps(),
43
43
  substitutions = [],
44
- suppositionsMatch = matchSuppositions(this.suppositions, metaproofSteps, substitutions, this.fileContext, localContext);
44
+ suppositionsMatch = matchSuppositions(this.suppositions, proofSteps, substitutions, this.fileContext, localContext);
45
45
 
46
46
  if (suppositionsMatch) {
47
47
  const consequentMatches = matchConsequent(this.consequent, statementNode, substitutions, this.fileContext, localContext);
@@ -77,22 +77,19 @@ export default class MetaLemmaMetatheorem {
77
77
  }),
78
78
  consequentJSON = this.consequent.toJSON(tokens),
79
79
  substitutionsJSON = this.substitutions.map((substitution) => {
80
- const substitutionJSON = substitution.toJSON();
80
+ const substitutionJSON = substitution.toJSON();
81
81
 
82
- return substitutionJSON;
83
- }),
84
- localContextJSON = this.fileContext.toJSON(tokens),
82
+ return substitutionJSON;
83
+ }),
85
84
  labels = labelsJSON, ///
86
85
  suppositions = suppositionsJSON, ///
87
86
  consequent = consequentJSON, ///
88
87
  substitutions = substitutionsJSON, ///
89
- fileContext = localContextJSON, ///
90
88
  json = {
91
89
  labels,
92
90
  suppositions,
93
91
  consequent,
94
- substitutions,
95
- fileContext
92
+ substitutions
96
93
  };
97
94
 
98
95
  return json;
@@ -143,13 +140,13 @@ export default class MetaLemmaMetatheorem {
143
140
  static fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(Class, labels, suppositions, consequent, substitutions, fileContext) { return new Class(labels, suppositions, consequent, substitutions, fileContext); }
144
141
  }
145
142
 
146
- function matchSuppositions(suppositions, metaproofSteps, substitutions, fileContext, localContext) {
143
+ function matchSuppositions(suppositions, proofSteps, substitutions, fileContext, localContext) {
147
144
  suppositions = reverse(suppositions); ///
148
145
 
149
- metaproofSteps = reverse(metaproofSteps); ///
146
+ proofSteps = reverse(proofSteps); ///
150
147
 
151
- const suppositionsMatch = correlate(suppositions, metaproofSteps, (supposition, metaproofStep) => {
152
- const suppositionMatches = matchSupposition(supposition, metaproofStep, substitutions, fileContext, localContext);
148
+ const suppositionsMatch = correlate(suppositions, proofSteps, (supposition, proofStep) => {
149
+ const suppositionMatches = matchSupposition(supposition, proofStep, substitutions, fileContext, localContext);
153
150
 
154
151
  if (suppositionMatches) {
155
152
  return true;
@@ -159,25 +156,18 @@ function matchSuppositions(suppositions, metaproofSteps, substitutions, fileCont
159
156
  return suppositionsMatch;
160
157
  }
161
158
 
162
- function matchSupposition(supposition, metaproofStep, substitutions, fileContext, localContext) {
163
- let matchesSupposition = false;
164
-
165
- const metaSubproofNode = metaproofStep.getSubproofNode(),
166
- statementNode = metaproofStep.getStatementNode();
159
+ function matchSupposition(supposition, proofStep, substitutions, fileContext, localContext) {
160
+ let suppositionMatches = false;
167
161
 
168
- if (metaSubproofNode !== null) {
169
- const suppositionMatchesSubproofNode = supposition.matchSubproofNode(metaSubproofNode, substitutions, fileContext, localContext);
170
-
171
- matchesSupposition - suppositionMatchesSubproofNode; ///
172
- }
162
+ const statementNode = proofStep.getStatementNode();
173
163
 
174
164
  if (statementNode !== null) {
175
165
  const suppositionMatchesStatementNode = supposition.matchStatementNode(statementNode, substitutions, fileContext, localContext);
176
166
 
177
- matchesSupposition - suppositionMatchesStatementNode; ///
167
+ suppositionMatches = suppositionMatchesStatementNode; ///
178
168
  }
179
169
 
180
- return matchesSupposition;
170
+ return suppositionMatches;
181
171
  }
182
172
 
183
173
  function matchConsequent(consequent, statementNode, substitutions, fileContext, localContext) {
@@ -17,8 +17,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
17
17
  let axiomVerified = false;
18
18
 
19
19
  const labelNodes = labelNodesQuery(axiomNode),
20
- labelsString = fileContext.nodesAsString(labelNodes),
21
- localContext = LocalContext.fromFileContext(fileContext);
20
+ labelsString = fileContext.nodesAsString(labelNodes);
22
21
 
23
22
  fileContext.trace(`Verifying the '${labelsString}' axiom...`, axiomNode);
24
23
 
@@ -26,7 +25,8 @@ export default function verifyAxiom(axiomNode, fileContext) {
26
25
  labelsVerified = verifyLabels(labelNodes, labels, fileContext);
27
26
 
28
27
  if (labelsVerified) {
29
- const suppositions = [],
28
+ const localContext = LocalContext.fromFileContext(fileContext),
29
+ suppositions = [],
30
30
  suppositionNodes = suppositionsNodeQuery(axiomNode),
31
31
  suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
32
32
 
@@ -38,7 +38,8 @@ export default function verifyAxiom(axiomNode, fileContext) {
38
38
  if (consequentVerified) {
39
39
  const firstConsequent = first(consequents),
40
40
  consequent = firstConsequent, ///
41
- axiom = Axiom.fromLabelsSuppositionsConsequentAndLocalContext(labels, suppositions, consequent, localContext);
41
+ substitutions = [],
42
+ axiom = Axiom.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
42
43
 
43
44
  fileContext.addAxiom(axiom);
44
45
 
@@ -19,8 +19,7 @@ export default function verifyConjecture(conjectureNode, fileContext) {
19
19
  let conjectureVerified = false;
20
20
 
21
21
  const labelNodes = labelNodesQuery(conjectureNode),
22
- labelsString = fileContext.nodesAsString(labelNodes),
23
- localContext = LocalContext.fromFileContext(fileContext); ///
22
+ labelsString = fileContext.nodesAsString(labelNodes);
24
23
 
25
24
  fileContext.trace(`Verifying the '${labelsString}' conjecture...`, conjectureNode);
26
25
 
@@ -28,7 +27,8 @@ export default function verifyConjecture(conjectureNode, fileContext) {
28
27
  labelsVerified = verifyLabels(labelNodes, labels, fileContext);
29
28
 
30
29
  if (labelsVerified) {
31
- const suppositions = [],
30
+ const localContext = LocalContext.fromFileContext(fileContext),
31
+ suppositions = [],
32
32
  suppositionNodes = suppositionsNodeQuery(conjectureNode),
33
33
  suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
34
34
 
@@ -46,7 +46,8 @@ export default function verifyConjecture(conjectureNode, fileContext) {
46
46
  verifyProof(proofNode, consequent, localContext);
47
47
  }
48
48
 
49
- const conjecture = Conjecture.fromLabelsSuppositionsConsequentAndLocalContext(labels, suppositions, consequent, localContext);
49
+ const substitutions = [],
50
+ conjecture = Conjecture.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
50
51
 
51
52
  fileContext.addConjecture(conjecture);
52
53
 
@@ -2,23 +2,21 @@
2
2
 
3
3
  import metaLevelNodeVerifier from "../verifier/node/metaLevel";
4
4
 
5
- import { CONTAINED } from "../constants";
6
5
  import { isStatementNegated } from "../utilities/verify";
7
6
  import { nodeQuery, nodesQuery } from "../utilities/query";
8
7
 
9
8
  const termNodeQuery = nodeQuery("/statement/term!"),
10
- statementTermNodesQuery = nodesQuery("/statement/metaArgument/statement//term"),
11
- operatorTerminalNodesQuery = nodesQuery("/statement/@operator");
9
+ statementTermNodesQuery = nodesQuery("/statement/metaArgument/statement//term");
12
10
 
13
- export default function verifyStatementAsContainedAssertion(statementNode, assignments, derived, localContext) {
11
+ export default function verifyContainedAssertion(containedAssertionNode, assignments, derived, localContext) {
14
12
  let statementVerifiedAsContainedAssertion;
15
13
 
16
- const statementContainedAssertion = isStatementContainedAssertion(statementNode);
14
+ const statementContainedAssertion = isStatementContainedAssertion(containedAssertionNode);
17
15
 
18
16
  if (statementContainedAssertion) {
19
- const statementString = localContext.nodeAsString(statementNode);
17
+ const containedAssertionString = localContext.nodeAsString(containedAssertionNode);
20
18
 
21
- localContext.trace(`Verifying the '${statementString}' statement as a contained assertion...`, statementNode);
19
+ localContext.trace(`Verifying the '${containedAssertionString}' statement as a contained assertion...`, containedAssertionNode);
22
20
 
23
21
  const statementFunctions = [
24
22
  verifyStatementAsDerivedContainedAssertion,
@@ -26,7 +24,7 @@ export default function verifyStatementAsContainedAssertion(statementNode, assig
26
24
  ];
27
25
 
28
26
  statementVerifiedAsContainedAssertion = statementFunctions.some((statementFunction) => {
29
- const statementVerifiedAsContainedAssertion = statementFunction(statementNode, assignments, derived, localContext);
27
+ const statementVerifiedAsContainedAssertion = statementFunction(containedAssertionNode, assignments, derived, localContext);
30
28
 
31
29
  if (statementVerifiedAsContainedAssertion) {
32
30
  return true;
@@ -34,25 +32,25 @@ export default function verifyStatementAsContainedAssertion(statementNode, assig
34
32
  });
35
33
 
36
34
  if (statementVerifiedAsContainedAssertion) {
37
- localContext.debug(`...verified the '${statementString}' statement as a contained assertion.`, statementNode);
35
+ localContext.debug(`...verified the '${containedAssertionString}' statement as a contained assertion.`, containedAssertionNode);
38
36
  }
39
37
  }
40
38
 
41
39
  return statementVerifiedAsContainedAssertion;
42
40
  }
43
41
 
44
- function verifyStatementAsDerivedContainedAssertion(statementNode, assignments, derived, localContext) {
42
+ function verifyStatementAsDerivedContainedAssertion(containedAssertionNode, assignments, derived, localContext) {
45
43
  let statementVerifiedAsDefinedContainedAssertion = false;
46
44
 
47
45
  if (derived) {
48
- const statementString = localContext.nodeAsString(statementNode);
46
+ const containedAssertionString = localContext.nodeAsString(containedAssertionNode);
49
47
 
50
- localContext.trace(`Verifying the derived '${statementString}' statement as a contained assertion...`, statementNode);
48
+ localContext.trace(`Verifying the '${containedAssertionString}' derived statement as a contained assertion...`, containedAssertionNode);
51
49
 
52
- const statementNegated = isStatementNegated(statementNode),
53
- termNode = termNodeQuery(statementNode),
50
+ const statementNegated = isStatementNegated(containedAssertionNode),
51
+ termNode = termNodeQuery(containedAssertionNode),
54
52
  negated = statementNegated, ///
55
- statementTermNodes = statementTermNodesQuery(statementNode),
53
+ statementTermNodes = statementTermNodesQuery(containedAssertionNode),
56
54
  termNodeMatchesMetaArgumentVariableNode = statementTermNodes.some((statementTermNode) => {
57
55
  const termNodeMatchesMetaArgumentVariableNode = termNode.match(statementTermNode);
58
56
 
@@ -74,27 +72,27 @@ function verifyStatementAsDerivedContainedAssertion(statementNode, assignments,
74
72
  }
75
73
 
76
74
  if (statementVerifiedAsDefinedContainedAssertion) {
77
- localContext.debug(`...verified the derived '${statementString}' statement as a contained assertion.`, statementNode);
75
+ localContext.debug(`...verified the '${containedAssertionString}' derived statement as a contained assertion.`, containedAssertionNode);
78
76
  }
79
77
  }
80
78
 
81
79
  return statementVerifiedAsDefinedContainedAssertion;
82
80
  }
83
81
 
84
- function verifyStatementAsStatedContainedAssertion(statementNode, assignments, derived, localContext) {
82
+ function verifyStatementAsStatedContainedAssertion(containedAssertionNode, assignments, derived, localContext) {
85
83
  let statementVerifiedAsStatedContainedAssertion = false;
86
84
 
87
85
  if (!derived) {
88
- const statementString = localContext.nodeAsString(statementNode);
86
+ const containedAssertionString = localContext.nodeAsString(containedAssertionNode);
89
87
 
90
- localContext.trace(`Verifying the stated '${statementString}' statement as a contained assertion...`, statementNode);
88
+ localContext.trace(`Verifying the '${containedAssertionString}' stated statement as a contained assertion...`, containedAssertionNode);
91
89
 
92
90
  const intrinsicLevel = localContext.isIntrinsicLevel();
93
91
 
94
92
  if (intrinsicLevel) {
95
- localContext.debug(`The stated '${statementString}' statement as a contained assertion cannot be verified at intrinsic level.`, statementNode);
93
+ localContext.debug(`The '${containedAssertionString}' stated statement as a contained assertion cannot be verified at intrinsic level.`, containedAssertionNode);
96
94
  } else {
97
- const nonTerminalNode = statementNode, ///
95
+ const nonTerminalNode = containedAssertionNode, ///
98
96
  nonTerminalNodeVerified = metaLevelNodeVerifier.verifyNonTerminalNode(nonTerminalNode, localContext, () => {
99
97
  const verifiedAhead = true;
100
98
 
@@ -105,23 +103,9 @@ function verifyStatementAsStatedContainedAssertion(statementNode, assignments, d
105
103
  }
106
104
 
107
105
  if (statementVerifiedAsStatedContainedAssertion) {
108
- localContext.debug(`...verified the stated '${statementString}' statement as a contained assertion.`, statementNode);
106
+ localContext.debug(`...verified the '${containedAssertionString}' stated statement as a contained assertion.`, containedAssertionNode);
109
107
  }
110
108
  }
111
109
 
112
110
  return statementVerifiedAsStatedContainedAssertion;
113
111
  }
114
-
115
- export function isStatementContainedAssertion(statementNode) {
116
- const operatorTerminalNodes = operatorTerminalNodesQuery(statementNode),
117
- statementContainedAssertion = operatorTerminalNodes.some((operatorTerminalNode) => {
118
- const content = operatorTerminalNode.getContent(),
119
- contentContained = (content === CONTAINED);
120
-
121
- if (contentContained) {
122
- return true;
123
- }
124
- });
125
-
126
- return statementContainedAssertion;
127
- }
@@ -57,7 +57,7 @@ function verifyReference(referenceNode, localContext) {
57
57
  localContext.trace(`Verifying the '${referenceString}' reference...`, referenceNode);
58
58
 
59
59
  const metavariableNode = metavariableNodeQuery(referenceNode),
60
- metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode, localContext);
60
+ metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
61
61
 
62
62
  if (metavariable !== null) {
63
63
  const metaType = metavariable.getMetaType();
@@ -5,22 +5,21 @@ import metaLevelNodeVerifier from "../verifier/node/metaLevel";
5
5
 
6
6
  import { first } from "../utilities/array";
7
7
  import { DEFINED } from "../constants";
8
- import { isStatementNegated } from "../utilities/verify";
9
- import { nodeQuery, nodesQuery } from "../utilities/query";
8
+ import { nodeQuery } from "../utilities/query";
9
+ import { isAssertionNegated } from "../utilities/verify";
10
10
 
11
11
  const termNodeQuery = nodeQuery("/statement/term!"),
12
- variableNodeQuery = nodeQuery("/statement/term/variable!"),
13
- operatorTerminalNodesQuery = nodesQuery("/statement/@operator");
12
+ variableNodeQuery = nodeQuery("/statement/term/variable!");
14
13
 
15
- export default function verifyStatementAsDefinedAssertion(statementNode, assignments, derived, localContext) {
14
+ export default function verifyDefinedAssertion(definedAssertionNode, assignments, derived, localContext) {
16
15
  let statementVerifiedAsDefinedAssertion = false;
17
16
 
18
- const statementDefinedAssertion = isStatementDefinedAssertion(statementNode);
17
+ const statementDefinedAssertion = isStatementDefinedAssertion(definedAssertionNode);
19
18
 
20
19
  if (statementDefinedAssertion) {
21
- const statementString = localContext.nodeAsString(statementNode);
20
+ const definedAssertionString = localContext.nodeAsString(definedAssertionNode);
22
21
 
23
- localContext.trace(`Verifying the '${statementString}' statement as a defined assertion...`, statementNode);
22
+ localContext.trace(`Verifying the '${definedAssertionString}' statement as a defined assertion...`, definedAssertionNode);
24
23
 
25
24
  const definedAssertionFunctions = [
26
25
  verifyDerivedStatementAsDefinedAssertion,
@@ -28,7 +27,7 @@ export default function verifyStatementAsDefinedAssertion(statementNode, assignm
28
27
  ];
29
28
 
30
29
  statementVerifiedAsDefinedAssertion = definedAssertionFunctions.some((definedAssertionFunction) => {
31
- const statementVerifiedAsDefinedAssertion = definedAssertionFunction(statementNode, assignments, derived, localContext);
30
+ const statementVerifiedAsDefinedAssertion = definedAssertionFunction(definedAssertionNode, assignments, derived, localContext);
32
31
 
33
32
  if (statementVerifiedAsDefinedAssertion) {
34
33
  return true;
@@ -36,24 +35,24 @@ export default function verifyStatementAsDefinedAssertion(statementNode, assignm
36
35
  });
37
36
 
38
37
  if (statementVerifiedAsDefinedAssertion) {
39
- localContext.debug(`...verified the '${statementString}' statement as a defined assertion.`, statementNode);
38
+ localContext.debug(`...verified the '${definedAssertionString}' statement as a defined assertion.`, definedAssertionNode);
40
39
  }
41
40
  }
42
41
 
43
42
  return statementVerifiedAsDefinedAssertion;
44
43
  }
45
44
 
46
- function verifyDerivedStatementAsDefinedAssertion(statementNode, assignments, derived, localContext) {
45
+ function verifyDerivedStatementAsDefinedAssertion(definedAssertionNode, assignments, derived, localContext) {
47
46
  let derivedStatementVerifiedAsDefeindAssertion = false;
48
47
 
49
48
  if (derived) {
50
- const statementString = localContext.nodeAsString(statementNode);
49
+ const definedAssertionString = localContext.nodeAsString(definedAssertionNode);
51
50
 
52
- localContext.trace(`Verifying the derived '${statementString}' statement as a defined assertion...`, statementNode);
51
+ localContext.trace(`Verifying the '${definedAssertionString}' derived statement as a defined assertion...`, definedAssertionNode);
53
52
 
54
- const statementNegated = isStatementNegated(statementNode),
55
- variableNode = variableNodeQuery(statementNode),
56
- termNode = termNodeQuery(statementNode);
53
+ const statementNegated = isAssertionNegated(definedAssertionNode),
54
+ variableNode = variableNodeQuery(definedAssertionNode),
55
+ termNode = termNodeQuery(definedAssertionNode);
57
56
 
58
57
  if (false) {
59
58
  ///
@@ -103,27 +102,27 @@ function verifyDerivedStatementAsDefinedAssertion(statementNode, assignments, de
103
102
  }
104
103
 
105
104
  if (derivedStatementVerifiedAsDefeindAssertion) {
106
- localContext.debug(`...verified the derived '${statementString}' statement as a defined assertion.`, statementNode);
105
+ localContext.debug(`...verified the '${definedAssertionString}' derived statement as a defined assertion.`, definedAssertionNode);
107
106
  }
108
107
  }
109
108
 
110
109
  return derivedStatementVerifiedAsDefeindAssertion;
111
110
  }
112
111
 
113
- function verifyStatedStatementAsDefinedAssertion(statementNode, assignments, derived, localContext) {
112
+ function verifyStatedStatementAsDefinedAssertion(definedAssertionNode, assignments, derived, localContext) {
114
113
  let statedStatementVerifiedAsDefinedAssertion = false;
115
114
 
116
115
  if (!derived) {
117
- const statementString = localContext.nodeAsString(statementNode);
116
+ const definedAssertionString = localContext.nodeAsString(definedAssertionNode);
118
117
 
119
- localContext.trace(`Verifying the stated '${statementString}' statement as a defined assertion...`, statementNode);
118
+ localContext.trace(`Verifying the '${definedAssertionString}' stated statement as a defined assertion...`, definedAssertionNode);
120
119
 
121
120
  const intrinsicLevel = localContext.isIntrinsicLevel();
122
121
 
123
122
  if (intrinsicLevel) {
124
- localContext.debug(`The stated '${statementString}' statement as a defined assertion cannot be verified at intrinsic level.`, statementNode);
123
+ localContext.debug(`The '${definedAssertionString}' stated statement as a defined assertion cannot be verified at intrinsic level.`, definedAssertionNode);
125
124
  } else {
126
- const nonTerminalNode = statementNode, ///
125
+ const nonTerminalNode = definedAssertionNode, ///
127
126
  nonTerminalNodeVerified = metaLevelNodeVerifier.verifyNonTerminalNode(nonTerminalNode, localContext, () => {
128
127
  const verifiedAhead = true;
129
128
 
@@ -134,23 +133,9 @@ function verifyStatedStatementAsDefinedAssertion(statementNode, assignments, der
134
133
  }
135
134
 
136
135
  if (statedStatementVerifiedAsDefinedAssertion) {
137
- localContext.debug(`...verified the stated '${statementString}' statement as a defined assertion.`, statementNode);
136
+ localContext.debug(`...verified the '${definedAssertionString}' stated statement as a defined assertion.`, definedAssertionNode);
138
137
  }
139
138
  }
140
139
 
141
140
  return statedStatementVerifiedAsDefinedAssertion;
142
141
  }
143
-
144
- export function isStatementDefinedAssertion(statementNode) {
145
- const operatorTerminalNodes = operatorTerminalNodesQuery(statementNode),
146
- statementDefinedAssertion = operatorTerminalNodes.some((operatorTerminalNode) => {
147
- const content = operatorTerminalNode.getContent(),
148
- contentDefined = (content === DEFINED);
149
-
150
- if (contentDefined) {
151
- return true;
152
- }
153
- });
154
-
155
- return statementDefinedAssertion;
156
- }
@@ -6,18 +6,18 @@ import { nodesQuery } from "../utilities/query";
6
6
 
7
7
  const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
8
8
 
9
- export default function verifyDerivation(ruleDerivationNode, localContext) {
10
- let ruleDerivationVerified;
9
+ export default function verifyDerivation(derivationNode, substitutions, localContext) {
10
+ let derivationVerified;
11
11
 
12
- const proofStepNodes = proofStepNodesQuery(ruleDerivationNode);
12
+ const proofStepNodes = proofStepNodesQuery(derivationNode);
13
13
 
14
- ruleDerivationVerified = proofStepNodes.every((proofStepNode) => {
15
- const proofStepVerified = verifyProofStep(proofStepNode, localContext);
14
+ derivationVerified = proofStepNodes.every((proofStepNode) => {
15
+ const proofStepVerified = verifyProofStep(proofStepNode, substitutions, localContext);
16
16
 
17
17
  if (proofStepVerified) {
18
18
  return true;
19
19
  }
20
20
  });
21
21
 
22
- return ruleDerivationVerified;
22
+ return derivationVerified;
23
23
  }
@@ -56,7 +56,7 @@ function verifyMetavariable(metavariableNode, declarations, localContext) {
56
56
 
57
57
  localContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
58
58
 
59
- const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode, localContext);
59
+ const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
60
60
 
61
61
  if (metavariable !== null) {
62
62
  const metaType = metavariable.getMetaType();
@@ -144,7 +144,7 @@ function verifyMetavariable(metavariableNode, localContext) {
144
144
 
145
145
  localContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
146
146
 
147
- const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode, localContext);
147
+ const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
148
148
 
149
149
  if (metavariable !== null) {
150
150
  const metaType = metavariable.getMetaType();
@@ -20,8 +20,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
20
20
  let lemmaVerified = false;
21
21
 
22
22
  const labelNodes = labelNodesQuery(lemmaNode),
23
- labelsString = fileContext.nodesAsString(labelNodes),
24
- localContext = LocalContext.fromFileContext(fileContext);
23
+ labelsString = fileContext.nodesAsString(labelNodes);
25
24
 
26
25
  (labelsString === EMPTY_STRING) ?
27
26
  fileContext.trace(`Verifying a lemma...`, lemmaNode) :
@@ -31,7 +30,8 @@ export default function verifyLemma(lemmaNode, fileContext) {
31
30
  labelsVerified = verifyLabels(labelNodes, labels, fileContext);
32
31
 
33
32
  if (labelsVerified) {
34
- const suppositions = [],
33
+ const localContext = LocalContext.fromFileContext(fileContext),
34
+ suppositions = [],
35
35
  suppositionNodes = suppositionsNodeQuery(lemmaNode),
36
36
  suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
37
37
 
@@ -44,10 +44,13 @@ export default function verifyLemma(lemmaNode, fileContext) {
44
44
  const proofNode = proofNodeQuery(lemmaNode),
45
45
  firstConsequent = first(consequents),
46
46
  consequent = firstConsequent, ///
47
- proofVerified = verifyProof(proofNode, consequent, localContext);
47
+ statementNode = consequent.getStatementNode(),
48
+ substitutions = [],
49
+ proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
48
50
 
49
51
  if (proofVerified) {
50
- const lemma = Lemma.fromLabelsSuppositionsConsequentAndLocalContext(labels, suppositions, consequent, localContext);
52
+ const substitutions = [],
53
+ lemma = Lemma.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
51
54
 
52
55
  fileContext.addLemma(lemma);
53
56
 
@@ -30,22 +30,22 @@ export default function verifyMetaLemma(metaLemmaNode, fileContext) {
30
30
  labelsVerified = verifyLabels(labelNodes, labels, fileContext);
31
31
 
32
32
  if (labelsVerified) {
33
- const localContext = LocalContext.fromFileContext(fileContext), ///
34
- substitutions = [],
33
+ const localContext = LocalContext.fromFileContext(fileContext),
35
34
  suppositions = [],
36
35
  suppositionNodes = suppositionsNodeQuery(metaLemmaNode),
37
- suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, substitutions, localContext);
36
+ suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
38
37
 
39
38
  if (suppositionsVerified) {
40
39
  const consequents = [],
41
40
  consequentNode = consequentNodeQuery(metaLemmaNode),
42
- consequentVerified = verifyConsequent(consequentNode, consequents, substitutions, localContext);
41
+ consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
43
42
 
44
43
  if (consequentVerified) {
45
44
  const proofNode = proofNodeQuery(metaLemmaNode),
46
45
  firstConsequent = first(consequents),
47
46
  consequent = firstConsequent, ///
48
47
  statementNode = consequent.getStatementNode(),
48
+ substitutions = [],
49
49
  proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
50
50
 
51
51
  if (proofVerified) {