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.
@@ -58,7 +58,7 @@ export default class Equivalence {
58
58
 
59
59
  equateTerm(term) {
60
60
  const termA = term, ///
61
- termEquates = this.terms.some((term) => {
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.terms.some((term) => {
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.terms.some((term) => {
101
+ variableNodeMatches = this.someTerm((term) => {
90
102
  const termNode = term.getNode(),
91
- variableNode = variableNodeQuery(termNode);
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
- matchTermNodes(termNodes) {
107
- const termNodesMatch = termNodes.every((termNode) => {
108
- const termNodeMatches = this.matchTermNode(termNode);
118
+ someTerm(callback) { return this.terms.some(callback); }
109
119
 
110
- if (termNodeMatches) {
111
- return true;
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
- return termNodesMatch;
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