occam-verify-cli 0.0.946 → 0.0.948

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 (64) hide show
  1. package/lib/assignment/equality.js +1 -1
  2. package/lib/assignment/judgement.js +1 -1
  3. package/lib/assignment/metavariable.js +1 -1
  4. package/lib/assignment/variable.js +1 -1
  5. package/lib/axiom.js +1 -1
  6. package/lib/combinator.js +1 -1
  7. package/lib/conclusion.js +1 -1
  8. package/lib/conjecture.js +1 -1
  9. package/lib/consequent.js +1 -1
  10. package/lib/constructor/bracketed.js +1 -1
  11. package/lib/constructor.js +1 -1
  12. package/lib/context/file.js +1 -1
  13. package/lib/context/local.js +1 -1
  14. package/lib/context/release.js +1 -1
  15. package/lib/declaration.js +1 -1
  16. package/lib/equality.js +1 -1
  17. package/lib/equivalence.js +1 -1
  18. package/lib/frame.js +1 -1
  19. package/lib/judgement.js +1 -1
  20. package/lib/label.js +1 -1
  21. package/lib/lemma.js +1 -1
  22. package/lib/log.js +1 -1
  23. package/lib/metaLemma.js +1 -1
  24. package/lib/metaType/frame.js +1 -1
  25. package/lib/metaType/reference.js +1 -1
  26. package/lib/metaType/statement.js +1 -1
  27. package/lib/metaType.js +1 -1
  28. package/lib/metatheorem.js +1 -1
  29. package/lib/metavariable.js +1 -1
  30. package/lib/ocmbinator/bracketed.js +1 -1
  31. package/lib/premise.js +1 -1
  32. package/lib/proofStep.js +1 -1
  33. package/lib/rule.js +1 -1
  34. package/lib/substitution/statementForMetavariable.js +1 -1
  35. package/lib/substitution/termForVariable.js +1 -1
  36. package/lib/substitution.js +1 -1
  37. package/lib/substitutions.js +1 -1
  38. package/lib/supposition.js +1 -1
  39. package/lib/term.js +1 -1
  40. package/lib/theorem.js +1 -1
  41. package/lib/topLevelAssertion.js +1 -1
  42. package/lib/type.js +1 -1
  43. package/lib/unifier/equality.js +1 -1
  44. package/lib/unifier/metaLevel.js +1 -1
  45. package/lib/unifier/statementAgainstCombinator.js +1 -1
  46. package/lib/unifier/termAgainstConstructor.js +1 -1
  47. package/lib/unifier.js +1 -1
  48. package/lib/unify/statementAgainstMetaType.js +24 -6
  49. package/lib/variable.js +1 -1
  50. package/lib/verifier/metaLevel.js +5 -2
  51. package/lib/verifier/statementAsCombinator.js +5 -2
  52. package/lib/verifier/termAsConstructor.js +1 -1
  53. package/lib/verifier/topLevel.js +1 -1
  54. package/lib/verifier.js +1 -1
  55. package/lib/verify/assertion/contained.js +2 -2
  56. package/lib/verify/assertion/type.js +36 -31
  57. package/lib/verify/term.js +14 -32
  58. package/package.json +1 -1
  59. package/src/unify/statementAgainstMetaType.js +33 -9
  60. package/src/verifier/metaLevel.js +5 -1
  61. package/src/verifier/statementAsCombinator.js +5 -1
  62. package/src/verify/assertion/contained.js +1 -1
  63. package/src/verify/assertion/type.js +51 -42
  64. package/src/verify/term.js +26 -59
@@ -6,6 +6,7 @@ import VariableAssignment from "../../assignment/variable";
6
6
 
7
7
  import { first } from "../../utilities/array";
8
8
  import { nodeQuery } from "../../utilities/query";
9
+ import local from "../../context/local";
9
10
 
10
11
  const termNodeQuery = nodeQuery("/typeAssertion/term!"),
11
12
  typeNodeQuery = nodeQuery("/typeAssertion/type!"),
@@ -46,39 +47,43 @@ function verifyDerivedTypeAssertion(typeAssertionNode, assignments, derived, loc
46
47
 
47
48
  localContext.trace(`Verifying the '${typeAssertionString}' derived type assertion...`, typeAssertionNode);
48
49
 
50
+ const typeNode = typeNodeQuery(typeAssertionNode),
51
+ type = localContext.findTypeByTypeNode(typeNode);
52
+
53
+ if (type === null) {
54
+ const typeString = localContext.nodeAsString(typeNode);
55
+
56
+ localContext.debug(`The '${typeString}' type is not present.`, typeNode);
57
+ }
58
+
49
59
  const terms = [],
50
60
  termNode = termNodeQuery(typeAssertionNode),
51
61
  termVerified = verifyTerm(termNode, terms, localContext, () => {
52
62
  let verifiedAhead = false;
53
63
 
54
- const typeNode = typeNodeQuery(typeAssertionNode),
55
- type = localContext.findTypeByTypeNode(typeNode);
56
-
57
- if (type !== null) {
58
- const firstTerm = first(terms),
59
- term = firstTerm, ///
60
- termType = localContext.getTermType(term),
61
- typeEqualToOrSuperTypeOfTermType = type.isEqualToOrSuperTypeOf(termType);
64
+ const firstTerm = first(terms),
65
+ term = firstTerm, ///
66
+ termType = localContext.getTermType(term),
67
+ typeEqualToOrSuperTypeOfTermType = type.isEqualToOrSuperTypeOf(termType);
62
68
 
63
- if (typeEqualToOrSuperTypeOfTermType) {
64
- const variableNode = variableNodeQuery(termNode);
69
+ if (typeEqualToOrSuperTypeOfTermType) {
70
+ const variableNode = variableNodeQuery(termNode);
65
71
 
66
- if (variableNode === null) {
67
- verifiedAhead = true;
68
- } else {
69
- let variable = localContext.findVariableByVariableNode(variableNode);
72
+ if (variableNode === null) {
73
+ verifiedAhead = true;
74
+ } else {
75
+ let variable;
70
76
 
71
- variable = Variable.fromVariableAndType(variable, type);
77
+ variable = localContext.findVariableByVariableNode(variableNode);
72
78
 
73
- const variableAssignment = VariableAssignment.fromVariable(variable),
74
- assignment = variableAssignment; ///
79
+ variable = Variable.fromVariableAndType(variable, type); ///
75
80
 
76
- assignments.push(assignment);
81
+ const variableAssignment = VariableAssignment.fromVariable(variable),
82
+ assignment = variableAssignment; ///
77
83
 
78
- verifiedAhead = true;
84
+ assignments.push(assignment);
79
85
 
80
- assignments.pop();
81
- }
86
+ verifiedAhead = true;
82
87
  }
83
88
  }
84
89
 
@@ -103,39 +108,43 @@ function verifyStatedTypeAssertion(typeAssertionNode, assignments, derived, loca
103
108
 
104
109
  localContext.trace(`Verifying the '${typeAssertionString}' stated type assertion...`, typeAssertionNode);
105
110
 
111
+ const typeNode = typeNodeQuery(typeAssertionNode),
112
+ type = localContext.findTypeByTypeNode(typeNode);
113
+
114
+ if (type === null) {
115
+ const typeString = localContext.nodeAsString(typeNode);
116
+
117
+ localContext.debug(`The '${typeString}' type is not present.`, typeNode);
118
+ }
119
+
106
120
  const terms = [],
107
121
  termNode = termNodeQuery(typeAssertionNode),
108
122
  termVerified = verifyTerm(termNode, terms, localContext, () => {
109
123
  let verifiedAhead = false;
110
124
 
111
- const typeNode = typeNodeQuery(typeAssertionNode),
112
- type = localContext.findTypeByTypeNode(typeNode);
113
-
114
- if (type !== null) {
115
- const firstTerm = first(terms),
116
- term = firstTerm, ///
117
- termType = term.getType(),
118
- typeEqualToOrSubTypeOfTermType = type.isEqualToOrSubTypeOf(termType);
125
+ const firstTerm = first(terms),
126
+ term = firstTerm, ///
127
+ termType = term.getType(),
128
+ typeEqualToOrSubTypeOfTermType = type.isEqualToOrSubTypeOf(termType);
119
129
 
120
- if (typeEqualToOrSubTypeOfTermType) {
121
- const variableNode = variableNodeQuery(termNode);
130
+ if (typeEqualToOrSubTypeOfTermType) {
131
+ const variableNode = variableNodeQuery(termNode);
122
132
 
123
- if (variableNode === null) {
124
- verifiedAhead = true;
125
- } else {
126
- let variable = localContext.findVariableByVariableNode(variableNode);
133
+ if (variableNode === null) {
134
+ verifiedAhead = true;
135
+ } else {
136
+ let variable;
127
137
 
128
- variable = Variable.fromVariableAndType(variable, type);
138
+ variable = localContext.findVariableByVariableNode(variableNode);
129
139
 
130
- const variableAssignment = VariableAssignment.fromVariable(variable),
131
- assignment = variableAssignment; ///
140
+ variable = Variable.fromVariableAndType(variable, type); ///
132
141
 
133
- assignments.push(assignment);
142
+ const variableAssignment = VariableAssignment.fromVariable(variable),
143
+ assignment = variableAssignment; ///
134
144
 
135
- verifiedAhead = true;
145
+ assignments.push(assignment);
136
146
 
137
- assignments.pop();
138
- }
147
+ verifiedAhead = true;
139
148
  }
140
149
  }
141
150
 
@@ -5,7 +5,6 @@ import Term from "../term";
5
5
  import bracketedConstructor from "../constructor/bracketed";
6
6
  import termAgainstConstructorUnifier from "../unifier/termAgainstConstructor";
7
7
 
8
- import { first } from "../utilities/array";
9
8
  import { nodeQuery } from "../utilities/query";
10
9
 
11
10
  const termNodeQuery = nodeQuery("/term/argument/term"),
@@ -69,7 +68,7 @@ function verifyTermAsVariable(termNode, terms, localContext, verifyAhead) {
69
68
 
70
69
  terms.pop();
71
70
 
72
- termVerifiedAsVariable = verifiedAhead; ///
71
+ termVerifiedAsVariable = verifiedAhead; ///
73
72
  }
74
73
 
75
74
  if (termVerifiedAsVariable) {
@@ -104,90 +103,58 @@ function unifyTermAgainstBracketedConstructor(termNode, terms, localContext, ver
104
103
  let termUnifiedAgainstBracketedConstructor;
105
104
 
106
105
  const termString = localContext.nodeAsString(termNode),
107
- bracketedConstructorString = bracketedConstructor.getString();
106
+ bracketedTerms = [];
108
107
 
109
- localContext.trace(`Unifying the '${termString}' term against the '${bracketedConstructorString}' bracketed constructor...`, termNode);
108
+ localContext.trace(`Unifying the '${termString}' term against the bracketed constructor...`, termNode);
110
109
 
111
- const bracketedConstructorTermNode = bracketedConstructor.getTermNode(),
112
- termNodeA = termNode, ///
113
- constructorTermNodeB = bracketedConstructorTermNode, ///
114
- unified = termAgainstConstructorUnifier.unify(termNodeA, constructorTermNodeB, localContext, () => {
115
- let verifiedAhead;
110
+ termUnifiedAgainstBracketedConstructor = unifyTermAgainstConstructor(termNode, bracketedTerms, bracketedConstructor, localContext, () => {
111
+ let verifiedAhead;
116
112
 
117
- const bracketedTermNode = termNode; ///
113
+ const bracketedTermNode = termNode; ///
118
114
 
119
- termNode = termNodeQuery(termNode); ///
115
+ termNode = termNodeQuery(bracketedTermNode); ///
120
116
 
121
- if (termNode === null) {
122
- verifiedAhead = false;
123
- } else {
124
- let type;
117
+ const termVVerified = verifyTerm(termNode, terms, localContext, verifyAhead);
125
118
 
126
- verifyTerm(termNode, terms, localContext, () => {
127
- let verifiedAhead;
119
+ verifiedAhead = termVVerified; ///
128
120
 
129
- const firstTerm = first(terms),
130
- term = firstTerm; ///
131
-
132
- type = term.getType();
133
-
134
- verifiedAhead = true;
135
-
136
- return verifiedAhead;
137
- });
138
-
139
- terms.pop();
140
-
141
- termNode = bracketedTermNode; ///
142
-
143
- const term = Term.fromTermNodeAndType(termNode, type);
144
-
145
- terms.push(term);
146
-
147
- verifiedAhead = verifyAhead();
148
-
149
- terms.pop();
150
- }
151
-
152
- return verifiedAhead;
153
- });
154
-
155
- termUnifiedAgainstBracketedConstructor = unified; ///
121
+ return verifiedAhead;
122
+ });
156
123
 
157
124
  if (termUnifiedAgainstBracketedConstructor) {
158
- localContext.debug(`...unified the '${termString}' term against the '${bracketedConstructorString}' constructor.`, termNode);
125
+ localContext.debug(`...unified the '${termString}' term against the bracketed constructor.`, termNode);
159
126
  }
160
127
 
161
128
  return termUnifiedAgainstBracketedConstructor;
162
129
  }
163
130
 
164
131
  function unifyTermAgainstConstructor(termNode, terms, constructor, localContext, verifyAhead) {
165
- let termUnifiedAgainstConstructor;
132
+ let termUnifiedAgainstConstructor = false;
166
133
 
167
134
  const termString = localContext.nodeAsString(termNode),
168
- constructorString = constructor.getString();
135
+ constructorString = constructor.getString(),
136
+ constructorTermNode = constructor.getTermNode();
169
137
 
170
138
  localContext.trace(`Unifying the '${termString}' term against the '${constructorString}' constructor...`, termNode);
171
139
 
172
- const constructorTermNode = constructor.getTermNode(),
173
- termNodeA = termNode, ///
140
+ const termNodeA = termNode, ///
174
141
  constructorTermNodeB = constructorTermNode, ///
175
- unified = termAgainstConstructorUnifier.unify(termNodeA, constructorTermNodeB, localContext, () => {
176
- let verifiedAhead;
142
+ unified = termAgainstConstructorUnifier.unify(termNodeA, constructorTermNodeB, localContext);
177
143
 
178
- const type = constructor.getType(),
179
- term = Term.fromTermNodeAndType(termNode, type);
144
+ if (unified) {
145
+ let verifiedAhead;
180
146
 
181
- terms.push(term);
147
+ const type = constructor.getType(),
148
+ term = Term.fromTermNodeAndType(termNode, type);
182
149
 
183
- verifiedAhead = verifyAhead();
150
+ terms.push(term);
184
151
 
185
- terms.pop();
152
+ verifiedAhead = verifyAhead();
186
153
 
187
- return verifiedAhead;
188
- });
154
+ terms.pop();
189
155
 
190
- termUnifiedAgainstConstructor = unified; ///
156
+ termUnifiedAgainstConstructor = verifiedAhead; ///
157
+ }
191
158
 
192
159
  if (termUnifiedAgainstConstructor) {
193
160
  localContext.debug(`...unified the '${termString}' term against the '${constructorString}' constructor.`, termNode);