occam-verify-cli 1.0.28 → 1.0.30
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/context/file.js +1 -8
- package/lib/context/local.js +35 -20
- package/lib/dom/assertion/property.js +22 -4
- package/lib/dom/proofStep.js +13 -1
- package/lib/dom/relation/property.js +33 -27
- package/lib/dom/term.js +2 -9
- package/lib/equivalence.js +30 -12
- package/lib/mixins/proofStep/unify.js +23 -1
- package/package.json +5 -5
- package/src/context/file.js +0 -6
- package/src/context/local.js +35 -25
- package/src/dom/assertion/property.js +30 -3
- package/src/dom/proofStep.js +13 -0
- package/src/dom/relation/property.js +34 -29
- package/src/dom/term.js +2 -11
- package/src/equivalence.js +29 -12
- package/src/mixins/proofStep/unify.js +34 -1
package/src/equivalence.js
CHANGED
|
@@ -58,7 +58,7 @@ export default class Equivalence {
|
|
|
58
58
|
|
|
59
59
|
equateTerm(term) {
|
|
60
60
|
const termA = term, ///
|
|
61
|
-
termEquates = this.
|
|
61
|
+
termEquates = this.someTerm((term) => {
|
|
62
62
|
const termB = term, ///
|
|
63
63
|
termAEqualToTermB = termA.isEqualTo(termB);
|
|
64
64
|
|
|
@@ -73,7 +73,7 @@ export default class Equivalence {
|
|
|
73
73
|
matchTermNode(termNode) {
|
|
74
74
|
termNode = stripBracketsFromTermNode(termNode); ///
|
|
75
75
|
|
|
76
|
-
const termNodeMatches = this.
|
|
76
|
+
const termNodeMatches = this.someTerm((term) => {
|
|
77
77
|
const termNodeMatches = term.matchTermNode(termNode);
|
|
78
78
|
|
|
79
79
|
if (termNodeMatches) {
|
|
@@ -84,11 +84,23 @@ export default class Equivalence {
|
|
|
84
84
|
return termNodeMatches;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
matchTermNodes(termNodes) {
|
|
88
|
+
const termNodesMatch = termNodes.every((termNode) => {
|
|
89
|
+
const termNodeMatches = this.matchTermNode(termNode);
|
|
90
|
+
|
|
91
|
+
if (termNodeMatches) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return termNodesMatch;
|
|
97
|
+
}
|
|
98
|
+
|
|
87
99
|
matchVariableNode(variableNode) {
|
|
88
100
|
const variableNodeA = variableNode, ///
|
|
89
|
-
variableNodeMatches = this.
|
|
101
|
+
variableNodeMatches = this.someTerm((term) => {
|
|
90
102
|
const termNode = term.getNode(),
|
|
91
|
-
|
|
103
|
+
variableNode = variableNodeQuery(termNode);
|
|
92
104
|
|
|
93
105
|
if (variableNode !== null) {
|
|
94
106
|
const variableNodeB = variableNode, ///
|
|
@@ -103,16 +115,21 @@ export default class Equivalence {
|
|
|
103
115
|
return variableNodeMatches;
|
|
104
116
|
}
|
|
105
117
|
|
|
106
|
-
|
|
107
|
-
const termNodesMatch = termNodes.every((termNode) => {
|
|
108
|
-
const termNodeMatches = this.matchTermNode(termNode);
|
|
118
|
+
someTerm(callback) { return this.terms.some(callback); }
|
|
109
119
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
120
|
+
someOtherTerm(term, callback) {
|
|
121
|
+
const termA = term, ///
|
|
122
|
+
terms = this.terms.filter((term) => {
|
|
123
|
+
const termB = term, ///
|
|
124
|
+
termAEqualToTermB = termA.isEqualTo(termB);
|
|
114
125
|
|
|
115
|
-
|
|
126
|
+
if (!termAEqualToTermB) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
}),
|
|
130
|
+
result = terms.some(callback);
|
|
131
|
+
|
|
132
|
+
return result;
|
|
116
133
|
}
|
|
117
134
|
|
|
118
135
|
getGroundedTerms(definedVariables, groundedTerms, context) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import StatementSubstitution from "../../substitution/statement";
|
|
4
4
|
|
|
5
|
-
import { equalityFromStatement, judgementFromStatement, typeAssertionFromStatement } from "../../utilities/context";
|
|
5
|
+
import { equalityFromStatement, judgementFromStatement, typeAssertionFromStatement, propertyAssertionFromStatement } from "../../utilities/context";
|
|
6
6
|
|
|
7
7
|
function unifyAWithRule(statement, reference, substitutions, context) {
|
|
8
8
|
let unifiedWithRule = false;
|
|
@@ -155,6 +155,38 @@ function unifyAsTypeAssertion(statement, reference, substitutions, context) {
|
|
|
155
155
|
return unifiedAsTypeAssertion;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
function unifyAsPropertyAssertion(statement, reference, substitutions, context) {
|
|
159
|
+
let unifiedAsPropertyAssertion = false;
|
|
160
|
+
|
|
161
|
+
if (reference === null) {
|
|
162
|
+
const propertyAssertion = propertyAssertionFromStatement(statement, context);
|
|
163
|
+
|
|
164
|
+
if (propertyAssertion !== null) {
|
|
165
|
+
const statementString = statement.getString();
|
|
166
|
+
|
|
167
|
+
context.trace(`Unifying the '${statementString}' statement as a property assertion...`);
|
|
168
|
+
|
|
169
|
+
const term = propertyAssertion.getTerm(),
|
|
170
|
+
equivalence = context.findEquivalenceByTerm(term);
|
|
171
|
+
|
|
172
|
+
if (equivalence !== null) {
|
|
173
|
+
unifiedAsPropertyAssertion = equivalence.someOtherTerm(term, (term) => { ///
|
|
174
|
+
const propertyRelation = propertyAssertion.getPropertyRelation(),
|
|
175
|
+
propertyAssertionMatches = context.matchTermAndPropertyRelation(term, propertyRelation);
|
|
176
|
+
|
|
177
|
+
if (propertyAssertionMatches) {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
context.debug(`...unified the '${statementString}' statement as a property assertion.`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return unifiedAsPropertyAssertion;
|
|
188
|
+
}
|
|
189
|
+
|
|
158
190
|
function unifyWithProofStepSubproofs(statement, reference, substitutions, context) {
|
|
159
191
|
let unifiedWithProofSteps = false;
|
|
160
192
|
|
|
@@ -175,6 +207,7 @@ const unifyMixins = [
|
|
|
175
207
|
unifyAsEquality,
|
|
176
208
|
unifyAsJudgement,
|
|
177
209
|
unifyAsTypeAssertion,
|
|
210
|
+
unifyAsPropertyAssertion,
|
|
178
211
|
unifyWithProofStepSubproofs
|
|
179
212
|
];
|
|
180
213
|
|