occam-verify-cli 0.0.526 → 0.0.527

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 (106) hide show
  1. package/lib/assertion/type.js +10 -40
  2. package/lib/axiom.js +7 -7
  3. package/lib/axiomLemmaTheoremConjecture.js +190 -0
  4. package/lib/conjecture.js +141 -0
  5. package/lib/consequence.js +3 -3
  6. package/lib/constants.js +4 -16
  7. package/lib/context/file.js +76 -39
  8. package/lib/context/metaproof.js +40 -10
  9. package/lib/context/proof.js +38 -105
  10. package/lib/context/release/directory.js +20 -1
  11. package/lib/context/release/file.js +27 -3
  12. package/lib/equality.js +78 -51
  13. package/lib/index.js +1 -13
  14. package/lib/kinds.js +5 -1
  15. package/lib/lemma.js +7 -7
  16. package/lib/matcher/metastatementForMetavariable.js +16 -19
  17. package/lib/matcher/statementForMetavariable.js +22 -20
  18. package/lib/matcher/{statementForVariable → termForVariable}/consequence.js +13 -13
  19. package/lib/matcher/{statementForVariable → termForVariable}/supposition.js +13 -13
  20. package/lib/matcher/termForVariable.js +198 -0
  21. package/lib/matcher.js +23 -64
  22. package/lib/mixins/file.js +62 -2
  23. package/lib/premise.js +4 -4
  24. package/lib/ruleNames.js +1 -9
  25. package/lib/step/proof.js +22 -1
  26. package/lib/substitution/statementForMetavariable.js +12 -8
  27. package/lib/substitution/termForVariable.js +86 -0
  28. package/lib/supposition.js +4 -4
  29. package/lib/theorem.js +7 -7
  30. package/lib/type.js +9 -2
  31. package/lib/utilities/string.js +3 -7
  32. package/lib/utilities/substitution.js +4 -5
  33. package/lib/variable.js +4 -38
  34. package/lib/verify/assertion/type.js +59 -36
  35. package/lib/verify/axiom.js +1 -2
  36. package/lib/verify/conjecture.js +56 -0
  37. package/lib/verify/declaration/topLevel.js +7 -3
  38. package/lib/verify/lemma.js +1 -2
  39. package/lib/verify/metastatement/qualified.js +1 -2
  40. package/lib/verify/metastatement/unqualified.js +1 -2
  41. package/lib/verify/rule.js +1 -2
  42. package/lib/verify/statement/qualified.js +39 -10
  43. package/lib/verify/statement/unqualified.js +1 -2
  44. package/lib/verify/statement.js +44 -47
  45. package/lib/verify/theorem.js +1 -2
  46. package/package.json +1 -1
  47. package/src/assertion/type.js +7 -32
  48. package/src/axiom.js +4 -4
  49. package/src/{axiomLemmaTheorem.js → axiomLemmaTheoremConjecture.js} +5 -5
  50. package/src/conjecture.js +13 -0
  51. package/src/consequence.js +2 -2
  52. package/src/constants.js +1 -4
  53. package/src/context/file.js +81 -37
  54. package/src/context/metaproof.js +42 -5
  55. package/src/context/proof.js +42 -41
  56. package/src/context/release/directory.js +24 -0
  57. package/src/context/release/file.js +34 -3
  58. package/src/equality.js +110 -61
  59. package/src/index.js +0 -3
  60. package/src/kinds.js +1 -0
  61. package/src/lemma.js +4 -4
  62. package/src/matcher/metastatementForMetavariable.js +22 -32
  63. package/src/matcher/statementForMetavariable.js +40 -34
  64. package/src/matcher/termForVariable/consequence.js +9 -0
  65. package/src/matcher/termForVariable/supposition.js +9 -0
  66. package/src/matcher/termForVariable.js +89 -0
  67. package/src/matcher.js +28 -22
  68. package/src/mixins/file.js +46 -1
  69. package/src/premise.js +4 -4
  70. package/src/ruleNames.js +0 -2
  71. package/src/step/proof.js +27 -0
  72. package/src/substitution/statementForMetavariable.js +17 -10
  73. package/src/substitution/termForVariable.js +64 -0
  74. package/src/supposition.js +3 -3
  75. package/src/theorem.js +4 -4
  76. package/src/type.js +14 -4
  77. package/src/utilities/string.js +4 -6
  78. package/src/utilities/substitution.js +6 -4
  79. package/src/variable.js +4 -37
  80. package/src/verify/assertion/type.js +70 -64
  81. package/src/verify/axiom.js +0 -1
  82. package/src/verify/conjecture.js +73 -0
  83. package/src/verify/declaration/topLevel.js +7 -0
  84. package/src/verify/lemma.js +0 -1
  85. package/src/verify/metastatement/qualified.js +0 -1
  86. package/src/verify/metastatement/unqualified.js +0 -1
  87. package/src/verify/rule.js +0 -1
  88. package/src/verify/statement/qualified.js +53 -13
  89. package/src/verify/statement/unqualified.js +0 -1
  90. package/src/verify/statement.js +46 -66
  91. package/src/verify/theorem.js +0 -1
  92. package/lib/axiomLemmaTheorem.js +0 -190
  93. package/lib/jsonTypes.js +0 -30
  94. package/lib/matcher/statementForVariable.js +0 -201
  95. package/lib/substitution/statementForVariable.js +0 -86
  96. package/lib/utilities/json.js +0 -187
  97. package/lib/utilities/version.js +0 -32
  98. package/lib/versionChanges.js +0 -34
  99. package/src/jsonTypes.js +0 -6
  100. package/src/matcher/statementForVariable/consequence.js +0 -9
  101. package/src/matcher/statementForVariable/supposition.js +0 -9
  102. package/src/matcher/statementForVariable.js +0 -99
  103. package/src/substitution/statementForVariable.js +0 -64
  104. package/src/utilities/json.js +0 -264
  105. package/src/utilities/version.js +0 -30
  106. package/src/versionChanges.js +0 -11
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
 
3
+ import Variable from "../../variable";
3
4
  import TypeAssertion from "../../assertion/type";
4
5
 
5
6
  import { first } from "../../utilities/array";
6
- import { nodeAsString } from "../../utilities/string";
7
+ import { verifyTermAsVariable } from "../../verify/term";
7
8
  import { nodeQuery, typeNameFromTypeNode } from "../../utilities/query";
8
- import { verifyTermAsVariable, verifyTermAgainstConstructors } from "../../verify/term";
9
9
 
10
10
  const termNodeQuery = nodeQuery("/typeAssertion/term"),
11
11
  typeNodeQuery = nodeQuery("/typeAssertion/type");
12
12
 
13
- export default function verifyTypeAssertion(typeAssertionNode, assertions, proofContext) {
13
+ export default function verifyTypeAssertion(typeAssertionNode, assertions, derived, proofContext) {
14
14
  let typeAssertionVerified = false;
15
15
 
16
16
  proofContext.begin(typeAssertionNode);
@@ -27,16 +27,16 @@ export default function verifyTypeAssertion(typeAssertionNode, assertions, proof
27
27
  proofContext.error(`The ${typeName} type is not present.`);
28
28
  } else {
29
29
  if (!typeAssertionVerified) {
30
- const variableTypeAssertionVerified = verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext);
30
+ const variableTypeAssertionVerified = verifyVariableTypeAssertion(typeAssertionNode, assertions, derived, proofContext);
31
31
 
32
32
  typeAssertionVerified = variableTypeAssertionVerified; ///
33
33
  }
34
34
 
35
- if (!typeAssertionVerified) {
36
- const termTypeAssertionVerified = verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext);
37
-
38
- typeAssertionVerified = termTypeAssertionVerified; ///
39
- }
35
+ // if (!typeAssertionVerified) {
36
+ // const termTypeAssertionVerified = verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext);
37
+ //
38
+ // typeAssertionVerified = termTypeAssertionVerified; ///
39
+ // }
40
40
  }
41
41
 
42
42
  if (typeAssertionVerified) {
@@ -50,7 +50,7 @@ export default function verifyTypeAssertion(typeAssertionNode, assertions, proof
50
50
  return typeAssertionVerified;
51
51
  }
52
52
 
53
- function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext) {
53
+ function verifyVariableTypeAssertion(typeAssertionNode, assertions, derived, proofContext) {
54
54
  let variableTypeAssertionVerified = false;
55
55
 
56
56
  const context = proofContext, ///
@@ -59,18 +59,28 @@ function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext
59
59
  termVerifiedAsVariable = verifyTermAsVariable(termNode, variables, context);
60
60
 
61
61
  if (termVerifiedAsVariable) {
62
- if (assertions === null) {
63
- variableTypeAssertionVerified = true;
62
+ const typeNode = typeNodeQuery(typeAssertionNode),
63
+ typeName = typeNameFromTypeNode(typeNode),
64
+ assertedTypeName = typeName, ///
65
+ assertedType = proofContext.findTypeByTypeName(assertedTypeName),
66
+ firstVariable = first(variables),
67
+ variable = firstVariable, ///
68
+ variableName = variable.getName(),
69
+ variableType = variable.getType();
70
+
71
+ if (derived) {
72
+ const variableTypeEqualToOrSubTypeOfAssertedType = variableType.isEqualToOrSubTypeOf(assertedType);
73
+
74
+ if (!variableTypeEqualToOrSubTypeOfAssertedType) {
75
+ const assertedTypeName = assertedType.getName(),
76
+ variableTypeName = variableType.getName();
77
+
78
+ proofContext.error(`The '${variableName}' variable's '${variableTypeName}' type is not equal to or a sub-type of the '${assertedTypeName}' asserted type.`);
79
+ } else {
80
+ variableTypeAssertionVerified = true;
81
+ }
64
82
  } else {
65
- const typeNode = typeNodeQuery(typeAssertionNode),
66
- typeName = typeNameFromTypeNode(typeNode),
67
- assertedTypeName = typeName, ///
68
- assertedType = proofContext.findTypeByTypeName(assertedTypeName),
69
- firstVariable = first(variables),
70
- variable = firstVariable, ///
71
- variableName = variable.getName(),
72
- variableType = variable.getType(),
73
- assertedTypeEqualToOrSubTypeOfVariableType = assertedType.isEqualToOrSubTypeOf(variableType);
83
+ const assertedTypeEqualToOrSubTypeOfVariableType = assertedType.isEqualToOrSubTypeOf(variableType);
74
84
 
75
85
  if (!assertedTypeEqualToOrSubTypeOfVariableType) {
76
86
  const assertedTypeName = assertedType.getName(),
@@ -79,7 +89,9 @@ function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext
79
89
  proofContext.error(`The '${assertedTypeName}' asserted type is not equal to or a sub-type of the '${variableName}' variable's '${variableTypeName}' type.`);
80
90
  } else {
81
91
  const type = assertedType, ///
82
- typeAssertion = TypeAssertion.fromTypeAndVariableName(type, variableName),
92
+ name = variableName, ///
93
+ variable = Variable.fromTypeAndName(type, name),
94
+ typeAssertion = TypeAssertion.fromVariable(variable),
83
95
  assertion = typeAssertion; ///
84
96
 
85
97
  assertions.push(assertion);
@@ -92,46 +104,40 @@ function verifyVariableTypeAssertion(typeAssertionNode, assertions, proofContext
92
104
  return variableTypeAssertionVerified;
93
105
  }
94
106
 
95
- function verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext) {
96
- let termTypeAssertionVerified = false;
97
-
98
- const types = [],
99
- context = proofContext, ///
100
- termNode = termNodeQuery(typeAssertionNode),
101
- termVerifiedAgainstConstructors = verifyTermAgainstConstructors(termNode, types, context);
102
-
103
- if (termVerifiedAgainstConstructors) {
104
- if (assertions === null) {
105
- termTypeAssertionVerified = true;
106
- } else {
107
- const typeNode = typeNodeQuery(typeAssertionNode),
108
- typeName = typeNameFromTypeNode(typeNode),
109
- assertedTypeName = typeName, ///
110
- assertedType = proofContext.findTypeByTypeName(assertedTypeName),
111
- firstType = first(types),
112
- termType = firstType,
113
- termString = proofContext.nodeAsString(termNode),
114
- assertedTypeEqualToTermType = (termType === null) ?
115
- true : ///
116
- assertedType.isEqualTo(termType);
117
-
118
- if (!assertedTypeEqualToTermType) {
119
- const termTypeName = termType.getName(),
120
- assertedTypeName = assertedType.getName();
121
-
122
- proofContext.error(`The '${assertedTypeName}' asserted type is not equal to the '${termString}' term's '${termTypeName}' type.`);
123
- } else {
124
- const type = assertedType, ///
125
- typeAssertion = TypeAssertion.fromTypeAndTermNode(type, termNode),
126
- assertion = typeAssertion; ///
127
-
128
- assertions.push(assertion);
129
-
130
- termTypeAssertionVerified = true;
131
- }
132
- }
133
- }
134
-
135
- return termTypeAssertionVerified;
136
- }
107
+ // function verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext) {
108
+ // let termTypeAssertionVerified = false;
109
+ //
110
+ // const types = [],
111
+ // context = proofContext, ///
112
+ // termNode = termNodeQuery(typeAssertionNode),
113
+ // termVerifiedAgainstConstructors = verifyTermAgainstConstructors(termNode, types, context);
114
+ //
115
+ // if (termVerifiedAgainstConstructors) {
116
+ // const typeNode = typeNodeQuery(typeAssertionNode),
117
+ // typeName = typeNameFromTypeNode(typeNode),
118
+ // assertedTypeName = typeName, ///
119
+ // assertedType = proofContext.findTypeByTypeName(assertedTypeName),
120
+ // firstType = first(types),
121
+ // termType = firstType,
122
+ // termString = proofContext.nodeAsString(termNode),
123
+ // termTypeEqualToOrSubTypeOfAssertedType = termType.isEqualToOrSubTypeOf(assertedType);
124
+ //
125
+ // if (!termTypeEqualToOrSubTypeOfAssertedType) {
126
+ // const termTypeName = termType.getName(),
127
+ // assertedTypeName = assertedType.getName();
128
+ //
129
+ // proofContext.error(`The '${termString}' term's '${termTypeName}' type is not equal to or a sub-type of the '${assertedTypeName}' asserted type.`);
130
+ // } else {
131
+ // const type = assertedType, ///
132
+ // typeAssertion = TypeAssertion.fromTypeAndTermNode(type, termNode),
133
+ // assertion = typeAssertion; ///
134
+ //
135
+ // assertions.push(assertion);
136
+ //
137
+ // termTypeAssertionVerified = true;
138
+ // }
139
+ // }
140
+ //
141
+ // return termTypeAssertionVerified;
142
+ // }
137
143
 
@@ -7,7 +7,6 @@ import verifySupposition from "../verify/supposition";
7
7
  import verifyConsequence from "../verify/consequence";
8
8
 
9
9
  import { first } from "../utilities/array";
10
- import { nodesAsString } from "../utilities/string";
11
10
  import { nodeQuery, nodesQuery } from "../utilities/query";
12
11
 
13
12
  const labelNodesQuery = nodesQuery("/axiom/label"),
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ import Conjecture from "../conjecture";
4
+ import verifyProof from "../verify/proof";
5
+ import ProofContext from "../context/proof";
6
+ import verifyLabels from "../verify/labels";
7
+ import verifySupposition from "./supposition";
8
+ import verifyConsequence from "./consequence";
9
+
10
+ import { first } from "../utilities/array";
11
+ import { nodeQuery, nodesQuery } from "../utilities/query";
12
+
13
+ const proofNodeQuery = nodeQuery("/conjecture/proof!"),
14
+ labelNodesQuery = nodesQuery("/conjecture/label"),
15
+ consequenceNodeQuery = nodeQuery("/conjecture/consequence!"),
16
+ suppositionsNodeQuery = nodesQuery("/conjecture/supposition");
17
+
18
+ export default function verifyConjecture(conjectureNode, fileContext) {
19
+ let conjectureVerified = false;
20
+
21
+ fileContext.begin(conjectureNode);
22
+
23
+ const labelNodes = labelNodesQuery(conjectureNode),
24
+ labelsString = fileContext.nodesAsString(labelNodes),
25
+ proofContext = ProofContext.fromFileContext(fileContext);
26
+
27
+ fileContext.debug(`Verifying the '${labelsString}' conjecture...`);
28
+
29
+ const labels = [],
30
+ labelsVerified = verifyLabels(labelNodes, labels, fileContext);
31
+
32
+ if (labelsVerified) {
33
+ const suppositions = [],
34
+ suppositionNodes = suppositionsNodeQuery(conjectureNode),
35
+ suppositionsVerified = suppositionNodes.every((suppositionNode) => {
36
+ const suppositionVerified = verifySupposition(suppositionNode, suppositions, proofContext);
37
+
38
+ if (suppositionVerified) {
39
+ return true;
40
+ }
41
+ });
42
+
43
+ if (suppositionsVerified) {
44
+ const consequences = [],
45
+ consequenceNode = consequenceNodeQuery(conjectureNode),
46
+ consequenceVerified = verifyConsequence(consequenceNode, consequences, proofContext);
47
+
48
+ if (consequenceVerified) {
49
+ const proofNode = proofNodeQuery(conjectureNode),
50
+ firstConsequence = first(consequences),
51
+ consequence = firstConsequence; ///
52
+
53
+ verifyProof(proofNode, consequence, proofContext);
54
+
55
+ const conjecture = Conjecture.fromLabelsSuppositionsAndConsequence(labels, suppositions, consequence);
56
+
57
+ fileContext.addConjecture(conjecture);
58
+
59
+ conjectureVerified = true;
60
+ }
61
+ }
62
+ }
63
+
64
+ if (conjectureVerified) {
65
+ fileContext.info(`Verified the '${labelsString}' conjecture.`);
66
+ }
67
+
68
+ conjectureVerified ?
69
+ fileContext.complete(conjectureNode) :
70
+ fileContext.complete(conjectureNode);
71
+
72
+ return conjectureVerified;
73
+ }
@@ -4,6 +4,7 @@ import verifyRule from "../../verify/rule";
4
4
  import verifyAxiom from "../../verify/axiom";
5
5
  import verifyLemma from "../../verify/lemma";
6
6
  import verifyTheorem from "../../verify/theorem";
7
+ import verifyConjecture from "../../verify/conjecture";
7
8
  import verifyTypeDeclaration from "../../verify/declaration/type";
8
9
  import verifyVariableDeclaration from "../../verify/declaration/variable";
9
10
  import verifyCombinatorDeclaration from "../../verify/declaration/combinator";
@@ -15,6 +16,7 @@ const ruleNodeQuery = nodeQuery("/topLevelDeclaration/rule!"),
15
16
  axiomNodeQuery = nodeQuery("/topLevelDeclaration/axiom!"),
16
17
  lemmaNodeQuery = nodeQuery("/topLevelDeclaration/lemma!"),
17
18
  theoremNodeQuery = nodeQuery("/topLevelDeclaration/theorem!"),
19
+ conjectureNodeQuery = nodeQuery("/topLevelDeclaration/conjecture!"),
18
20
  typeDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/typeDeclaration!"),
19
21
  variableDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/variableDeclaration!"),
20
22
  combinatorDeclarationNodeQuery = nodeQuery("/topLevelDeclaration/combinatorDeclaration!"),
@@ -30,6 +32,7 @@ export default function verifyTopLevelDeclaration(topLevelDeclarationNode, fileC
30
32
  axiomNode = axiomNodeQuery(node),
31
33
  lemmaNode = lemmaNodeQuery(node),
32
34
  theoremNode = theoremNodeQuery(node),
35
+ conjectureNode = conjectureNodeQuery(node),
33
36
  typeDeclarationNode = typeDeclarationNodeQuery(node),
34
37
  variableDeclarationNode = variableDeclarationNodeQuery(node),
35
38
  combinatorDeclarationNode = combinatorDeclarationNodeQuery(node),
@@ -53,6 +56,10 @@ export default function verifyTopLevelDeclaration(topLevelDeclarationNode, fileC
53
56
  const theoremVerified = verifyTheorem(theoremNode, fileContext);
54
57
 
55
58
  topLevelDeclarationVerified = theoremVerified; ///
59
+ } else if (conjectureNode !== null) {
60
+ const conjectureVerified = verifyConjecture(conjectureNode, fileContext);
61
+
62
+ topLevelDeclarationVerified = conjectureVerified; ///
56
63
  } else if (typeDeclarationNode !== null) {
57
64
  const typeDeclarationVerified = verifyTypeDeclaration(typeDeclarationNode, fileContext);
58
65
 
@@ -9,7 +9,6 @@ import verifyConsequence from "./consequence";
9
9
 
10
10
  import { first } from "../utilities/array";
11
11
  import { EMPTY_STRING } from "../constants";
12
- import { nodesAsString } from "../utilities/string";
13
12
  import { nodeQuery, nodesQuery } from "../utilities/query";
14
13
 
15
14
  const proofNodeQuery = nodeQuery("/lemma/proof!"),
@@ -2,7 +2,6 @@
2
2
 
3
3
  import verifyMetastatement from "../../verify/metastatement";
4
4
 
5
- import { nodeAsString } from "../../utilities/string";
6
5
  import { nodeQuery, referenceNameFromReferenceNode } from "../../utilities/query";
7
6
 
8
7
  const referenceNodeQuery = nodeQuery("/qualifiedMetastatement/qualification!/reference!"),
@@ -3,7 +3,6 @@
3
3
  import verifyMetastatement from "../metastatement";
4
4
 
5
5
  import { nodeQuery } from "../../utilities/query";
6
- import { nodeAsString } from "../../utilities/string";
7
6
 
8
7
  const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!");
9
8
 
@@ -8,7 +8,6 @@ import MetaproofContext from "../context/metaproof";
8
8
  import verifyConclusion from "../verify/conclusion";
9
9
 
10
10
  import { first } from "../utilities/array";
11
- import { nodesAsString } from "../utilities/string";
12
11
  import { nodeQuery, nodesQuery } from "../utilities/query";
13
12
 
14
13
  const labelNodesQuery = nodesQuery("/rule/label"),
@@ -2,7 +2,6 @@
2
2
 
3
3
  import verifyStatement from "../../verify/statement";
4
4
 
5
- import { nodeAsString } from "../../utilities/string";
6
5
  import { nodeQuery, referenceNameFromReferenceNode } from "../../utilities/query";
7
6
 
8
7
  const referenceNodeQuery = nodeQuery("/qualifiedStatement/qualification!/reference!"),
@@ -20,24 +19,65 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, asserti
20
19
 
21
20
  proofContext.debug(`Verifying the '${statementString}' qualified statement...`);
22
21
 
23
- let ruleMatchesStatement = true;
24
-
25
22
  const referenceNode = referenceNodeQuery(qualifiedStatementNode);
26
23
 
27
- if (referenceNode !== null) {
28
- const referenceName = referenceNameFromReferenceNode(referenceNode),
29
- rule = proofContext.findRuleByReferenceName(referenceName);
30
-
31
- if (rule !== null) {
32
- ruleMatchesStatement = rule.matchStatement(statementNode, proofContext);
33
- }
34
- }
35
-
36
- if (ruleMatchesStatement) {
24
+ if (referenceNode === null) {
37
25
  const context = proofContext,
38
26
  statementVerified = verifyStatement(statementNode, assertions, derived, context);
39
27
 
40
28
  qualifiedStatementVerified = statementVerified; ///
29
+ } else {
30
+ const referenceName = referenceNameFromReferenceNode(referenceNode);
31
+
32
+ if (!qualifiedStatementVerified) {
33
+ const rule = proofContext.findRuleByReferenceName(referenceName);
34
+
35
+ if (rule !== null) {
36
+ const ruleMatchesStatement = rule.matchStatement(statementNode, proofContext);
37
+
38
+ qualifiedStatementVerified = ruleMatchesStatement; ///
39
+ }
40
+ }
41
+
42
+ if (!qualifiedStatementVerified) {
43
+ const axiom = proofContext.findAxiomByReferenceName(referenceName);
44
+
45
+ if (axiom !== null) {
46
+ const axiomMatchesStatement = axiom.matchStatement(statementNode, proofContext);
47
+
48
+ qualifiedStatementVerified = axiomMatchesStatement; ///
49
+ }
50
+ }
51
+
52
+ if (!qualifiedStatementVerified) {
53
+ const lemma = proofContext.findLemmaByReferenceName(referenceName);
54
+
55
+ if (lemma !== null) {
56
+ const lemmaMatchesStatement = lemma.matchStatement(statementNode, proofContext);
57
+
58
+ qualifiedStatementVerified = lemmaMatchesStatement; ///
59
+ }
60
+ }
61
+
62
+ if (!qualifiedStatementVerified) {
63
+ const theorem = proofContext.findTheoremByReferenceName(referenceName);
64
+
65
+ if (theorem !== null) {
66
+ const theoremMatchesStatement = theorem.matchStatement(statementNode, proofContext);
67
+
68
+ qualifiedStatementVerified = theoremMatchesStatement; ///
69
+ }
70
+ }
71
+
72
+ if (!qualifiedStatementVerified) {
73
+ const conjecture = proofContext.findConjectureByReferenceName(referenceName);
74
+
75
+ if (conjecture !== null) {
76
+ const conjectureMatchesStatement = conjecture.matchStatement(statementNode, proofContext);
77
+
78
+ qualifiedStatementVerified = conjectureMatchesStatement; ///
79
+ }
80
+ }
41
81
  }
42
82
  }
43
83
 
@@ -3,7 +3,6 @@
3
3
  import verifyStatement from "../statement";
4
4
 
5
5
  import { nodeQuery } from "../../utilities/query";
6
- import { nodeAsString } from "../../utilities/string";
7
6
 
8
7
  const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!");
9
8
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  import Equality from "../equality";
4
4
  import verifyTerm from "../verify/term";
5
- import equalityCombinator from "../ocmbinator/equality";
6
5
  import bracketedCombinator from "../ocmbinator/bracketed";
7
6
  import verifyTypeAssertion from "../verify/assertion/type";
8
7
 
@@ -10,7 +9,6 @@ import { first } from "../utilities/array";
10
9
  import { objectType } from "../type";
11
10
  import { OBJECT_TYPE_NAME } from "../typeNames";
12
11
  import { STATEMENT_META_TYPE } from "../metaTypes";
13
- import { MAXIMUM_INDEXES_LENGTH } from "../constants";
14
12
  import { nodeQuery, typeNameFromTypeNode } from "../utilities/query";
15
13
  import { ARGUMENT_RULE_NAME, META_ARGUMENT_RULE_NAME } from "../ruleNames";
16
14
 
@@ -26,21 +24,21 @@ export default function verifyStatement(statementNode, assertions, derived, cont
26
24
  context.begin(statementNode);
27
25
 
28
26
  if (!statementVerified) {
29
- const statementVerifiedAsEquality = verifyStatementAsEquality(statementNode, derived, context);
27
+ const statementVerifiedAgainstCombinators = verifyStatementAgainstCombinators(statementNode, context);
30
28
 
31
- statementVerified = statementVerifiedAsEquality; //
29
+ statementVerified = statementVerifiedAgainstCombinators; ///
32
30
  }
33
31
 
34
32
  if (!statementVerified) {
35
- const statementVerifiedAsTypeAssertion = verifyStatementAsTypeAssertion(statementNode, assertions, context);
33
+ const statementVerifiedAsTypeAssertion = verifyStatementAsTypeAssertion(statementNode, assertions, derived, context);
36
34
 
37
35
  statementVerified = statementVerifiedAsTypeAssertion; ///
38
36
  }
39
37
 
40
38
  if (!statementVerified) {
41
- const statementVerifiedAgainstCombinators = verifyStatementAgainstCombinators(statementNode, context);
39
+ const statementVerifiedAsEquality = verifyStatementAsEquality(statementNode, derived, context);
42
40
 
43
- statementVerified = statementVerifiedAgainstCombinators; ///
41
+ statementVerified = statementVerifiedAsEquality; //
44
42
  }
45
43
 
46
44
  statementVerified ?
@@ -50,40 +48,14 @@ export default function verifyStatement(statementNode, assertions, derived, cont
50
48
  return statementVerified;
51
49
  }
52
50
 
53
- function verifyStatementAsEquality(statementNode, derived, context) {
54
- let statementVerifiedAsEquality = false;
55
-
56
- const combinator = equalityCombinator, ///
57
- statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, context);
58
-
59
- if (statementVerifiedAgainstCombinator) {
60
- statementVerifiedAsEquality = true;
61
-
62
- if (derived) {
63
- const equality = Equality.fromStatementNode(statementNode),
64
- proofSteps = context.getProofSteps(),
65
- equalities = equalitiesFromProofSteps(proofSteps),
66
- equalityEquates = equality.equate(equalities);
67
-
68
- statementVerifiedAsEquality = equalityEquates; ///
69
- }
70
- }
71
-
72
- return statementVerifiedAsEquality;
73
- }
74
-
75
- function verifyStatementAsTypeAssertion(statementNode, assertions, context) {
76
- let statementVerifiedAsTypeAssertion = false;
77
-
78
- const typeAssertionNode = typeAssertionNodeQuery(statementNode);
79
-
80
- if (typeAssertionNode !== null) {
81
- const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assertions, context);
82
-
83
- statementVerifiedAsTypeAssertion = typeAssertionVerified; ///
84
- }
51
+ export function verifyStatementAgainstCombinator(statementNode, combinator, context) {
52
+ const combinatorStatementNode = combinator.getStatementNode(),
53
+ node = statementNode, ///
54
+ combinatorNode = combinatorStatementNode, ///
55
+ nodeVerified = verifyNode(node, combinatorNode, context),
56
+ statementVerifiedAgainstCombinator = nodeVerified; ///
85
57
 
86
- return statementVerifiedAsTypeAssertion;
58
+ return statementVerifiedAgainstCombinator;
87
59
  }
88
60
 
89
61
  function verifyStatementAgainstCombinators(statementNode, context) {
@@ -111,14 +83,40 @@ function verifyStatementAgainstCombinators(statementNode, context) {
111
83
  return statementVerifiedAgainstCombinators;
112
84
  }
113
85
 
114
- function verifyStatementAgainstCombinator(statementNode, combinator, context) {
115
- const combinatorStatementNode = combinator.getStatementNode(),
116
- node = statementNode, ///
117
- combinatorNode = combinatorStatementNode, ///
118
- nodeVerified = verifyNode(node, combinatorNode, context),
119
- statementVerifiedAgainstCombinator = nodeVerified; ///
86
+ function verifyStatementAsTypeAssertion(statementNode, assertions, derived, context) {
87
+ let statementVerifiedAsTypeAssertion = false;
120
88
 
121
- return statementVerifiedAgainstCombinator;
89
+ const typeAssertionNode = typeAssertionNodeQuery(statementNode);
90
+
91
+ if (typeAssertionNode !== null) {
92
+ const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assertions, derived, context);
93
+
94
+ statementVerifiedAsTypeAssertion = typeAssertionVerified; ///
95
+ }
96
+
97
+ return statementVerifiedAsTypeAssertion;
98
+ }
99
+
100
+ function verifyStatementAsEquality(statementNode, derived, context) {
101
+ let statementVerifiedAsEquality = false;
102
+
103
+ const equality = Equality.fromStatementNode(statementNode, context);
104
+
105
+ if (equality !== null) {
106
+ statementVerifiedAsEquality = true; ///
107
+
108
+ if (derived) {
109
+ const equalities = context.getEqualities();
110
+
111
+ if (equalities !== null) {
112
+ const equalityEquates = equality.equate(equalities, context);
113
+
114
+ statementVerifiedAsEquality = equalityEquates; ///
115
+ }
116
+ }
117
+ }
118
+
119
+ return statementVerifiedAsEquality;
122
120
  }
123
121
 
124
122
  function verifyNode(node, combinatorNode, context) {
@@ -266,7 +264,7 @@ function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, co
266
264
  context.error(`The '${metaArgumentString}' meta-argument should be a statement, not a meta-type.`);
267
265
  } else {
268
266
  const derived = false,
269
- assertions = null,
267
+ assertions = [],
270
268
  statementVerified = verifyStatement(statementNode, assertions, derived, context);
271
269
 
272
270
  if (statementVerified) {
@@ -290,21 +288,3 @@ function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, co
290
288
 
291
289
  return metaArgumentNodeVerified;
292
290
  }
293
-
294
- function equalitiesFromProofSteps(proofSteps) {
295
- const start = -MAXIMUM_INDEXES_LENGTH; ///
296
-
297
- proofSteps = proofSteps.slice(start); ///
298
-
299
- const equalities = proofSteps.reduce((equalities, proofStep, index) => {
300
- const equality = Equality.fromProofStep(proofStep);
301
-
302
- if (equality !== null) {
303
- equalities.push(equality);
304
- }
305
-
306
- return equalities;
307
- }, []);
308
-
309
- return equalities;
310
- }
@@ -8,7 +8,6 @@ import verifySupposition from "./supposition";
8
8
  import verifyConsequence from "./consequence";
9
9
 
10
10
  import { first } from "../utilities/array";
11
- import { nodesAsString } from "../utilities/string";
12
11
  import { nodeQuery, nodesQuery } from "../utilities/query";
13
12
 
14
13
  const proofNodeQuery = nodeQuery("/theorem/proof!"),