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.
- package/lib/assignment/equality.js +1 -1
- package/lib/assignment/judgement.js +1 -1
- package/lib/assignment/metavariable.js +1 -1
- package/lib/assignment/variable.js +1 -1
- package/lib/axiom.js +1 -1
- package/lib/combinator.js +1 -1
- package/lib/conclusion.js +1 -1
- package/lib/conjecture.js +1 -1
- package/lib/consequent.js +1 -1
- package/lib/constructor/bracketed.js +1 -1
- package/lib/constructor.js +1 -1
- package/lib/context/file.js +1 -1
- package/lib/context/local.js +1 -1
- package/lib/context/release.js +1 -1
- package/lib/declaration.js +1 -1
- package/lib/equality.js +1 -1
- package/lib/equivalence.js +1 -1
- package/lib/frame.js +1 -1
- package/lib/judgement.js +1 -1
- package/lib/label.js +1 -1
- package/lib/lemma.js +1 -1
- package/lib/log.js +1 -1
- package/lib/metaLemma.js +1 -1
- package/lib/metaType/frame.js +1 -1
- package/lib/metaType/reference.js +1 -1
- package/lib/metaType/statement.js +1 -1
- package/lib/metaType.js +1 -1
- package/lib/metatheorem.js +1 -1
- package/lib/metavariable.js +1 -1
- package/lib/ocmbinator/bracketed.js +1 -1
- package/lib/premise.js +1 -1
- package/lib/proofStep.js +1 -1
- package/lib/rule.js +1 -1
- package/lib/substitution/statementForMetavariable.js +1 -1
- package/lib/substitution/termForVariable.js +1 -1
- package/lib/substitution.js +1 -1
- package/lib/substitutions.js +1 -1
- package/lib/supposition.js +1 -1
- package/lib/term.js +1 -1
- package/lib/theorem.js +1 -1
- package/lib/topLevelAssertion.js +1 -1
- package/lib/type.js +1 -1
- package/lib/unifier/equality.js +1 -1
- package/lib/unifier/metaLevel.js +1 -1
- package/lib/unifier/statementAgainstCombinator.js +1 -1
- package/lib/unifier/termAgainstConstructor.js +1 -1
- package/lib/unifier.js +1 -1
- package/lib/unify/statementAgainstMetaType.js +24 -6
- package/lib/variable.js +1 -1
- package/lib/verifier/metaLevel.js +5 -2
- package/lib/verifier/statementAsCombinator.js +5 -2
- package/lib/verifier/termAsConstructor.js +1 -1
- package/lib/verifier/topLevel.js +1 -1
- package/lib/verifier.js +1 -1
- package/lib/verify/assertion/contained.js +2 -2
- package/lib/verify/assertion/type.js +36 -31
- package/lib/verify/term.js +14 -32
- package/package.json +1 -1
- package/src/unify/statementAgainstMetaType.js +33 -9
- package/src/verifier/metaLevel.js +5 -1
- package/src/verifier/statementAsCombinator.js +5 -1
- package/src/verify/assertion/contained.js +1 -1
- package/src/verify/assertion/type.js +51 -42
- 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
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
64
|
-
|
|
69
|
+
if (typeEqualToOrSuperTypeOfTermType) {
|
|
70
|
+
const variableNode = variableNodeQuery(termNode);
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
if (variableNode === null) {
|
|
73
|
+
verifiedAhead = true;
|
|
74
|
+
} else {
|
|
75
|
+
let variable;
|
|
70
76
|
|
|
71
|
-
|
|
77
|
+
variable = localContext.findVariableByVariableNode(variableNode);
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
assignment = variableAssignment; ///
|
|
79
|
+
variable = Variable.fromVariableAndType(variable, type); ///
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
const variableAssignment = VariableAssignment.fromVariable(variable),
|
|
82
|
+
assignment = variableAssignment; ///
|
|
77
83
|
|
|
78
|
-
|
|
84
|
+
assignments.push(assignment);
|
|
79
85
|
|
|
80
|
-
|
|
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
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
121
|
-
|
|
130
|
+
if (typeEqualToOrSubTypeOfTermType) {
|
|
131
|
+
const variableNode = variableNodeQuery(termNode);
|
|
122
132
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
133
|
+
if (variableNode === null) {
|
|
134
|
+
verifiedAhead = true;
|
|
135
|
+
} else {
|
|
136
|
+
let variable;
|
|
127
137
|
|
|
128
|
-
|
|
138
|
+
variable = localContext.findVariableByVariableNode(variableNode);
|
|
129
139
|
|
|
130
|
-
|
|
131
|
-
assignment = variableAssignment; ///
|
|
140
|
+
variable = Variable.fromVariableAndType(variable, type); ///
|
|
132
141
|
|
|
133
|
-
|
|
142
|
+
const variableAssignment = VariableAssignment.fromVariable(variable),
|
|
143
|
+
assignment = variableAssignment; ///
|
|
134
144
|
|
|
135
|
-
|
|
145
|
+
assignments.push(assignment);
|
|
136
146
|
|
|
137
|
-
|
|
138
|
-
}
|
|
147
|
+
verifiedAhead = true;
|
|
139
148
|
}
|
|
140
149
|
}
|
|
141
150
|
|
package/src/verify/term.js
CHANGED
|
@@ -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
|
-
|
|
106
|
+
bracketedTerms = [];
|
|
108
107
|
|
|
109
|
-
localContext.trace(`Unifying the '${termString}' term against the
|
|
108
|
+
localContext.trace(`Unifying the '${termString}' term against the bracketed constructor...`, termNode);
|
|
110
109
|
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
113
|
+
const bracketedTermNode = termNode; ///
|
|
118
114
|
|
|
119
|
-
|
|
115
|
+
termNode = termNodeQuery(bracketedTermNode); ///
|
|
120
116
|
|
|
121
|
-
|
|
122
|
-
verifiedAhead = false;
|
|
123
|
-
} else {
|
|
124
|
-
let type;
|
|
117
|
+
const termVVerified = verifyTerm(termNode, terms, localContext, verifyAhead);
|
|
125
118
|
|
|
126
|
-
|
|
127
|
-
let verifiedAhead;
|
|
119
|
+
verifiedAhead = termVVerified; ///
|
|
128
120
|
|
|
129
|
-
|
|
130
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
179
|
-
|
|
144
|
+
if (unified) {
|
|
145
|
+
let verifiedAhead;
|
|
180
146
|
|
|
181
|
-
|
|
147
|
+
const type = constructor.getType(),
|
|
148
|
+
term = Term.fromTermNodeAndType(termNode, type);
|
|
182
149
|
|
|
183
|
-
|
|
150
|
+
terms.push(term);
|
|
184
151
|
|
|
185
|
-
|
|
152
|
+
verifiedAhead = verifyAhead();
|
|
186
153
|
|
|
187
|
-
|
|
188
|
-
});
|
|
154
|
+
terms.pop();
|
|
189
155
|
|
|
190
|
-
|
|
156
|
+
termUnifiedAgainstConstructor = verifiedAhead; ///
|
|
157
|
+
}
|
|
191
158
|
|
|
192
159
|
if (termUnifiedAgainstConstructor) {
|
|
193
160
|
localContext.debug(`...unified the '${termString}' term against the '${constructorString}' constructor.`, termNode);
|