occam-verify-cli 1.0.357 → 1.0.359

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.
@@ -162,8 +162,8 @@ class LocalContext {
162
162
  addJudgement(judgement) {
163
163
  let judgementAdded = false;
164
164
 
165
- const metavariable = judgement.getMetavariable(),
166
- judgementPresent = this.isJudgementPresentByMetavariable(metavariable);
165
+ const simpleReference = judgement.getSimpleReference(),
166
+ judgementPresent = this.isJudgementPresentBySimpleReference(simpleReference);
167
167
 
168
168
  if (!judgementPresent) {
169
169
  this.judgements.push(judgement);
@@ -209,16 +209,16 @@ class LocalContext {
209
209
  return variable;
210
210
  }
211
211
 
212
- findJudgementByMetavariable(metavariable) {
212
+ findJudgementBySimpleReference(simpleReference) {
213
213
  const judgements = this.getJudgements(),
214
214
  judgement = judgements.find((judgement) => {
215
215
  const judgementSimple = judgement.isSimple();
216
216
 
217
217
  if (judgementSimple) {
218
- const judgementMetavariable = judgement.getMetavariable(),
219
- judgementMetavariableEqualToMetavariable = judgementMetavariable.isEqualTo(metavariable);
218
+ const judgementSimpleReference = judgement.getSimpleReference(),
219
+ judgementSimpleReferenceEqualToSimpleReference = judgementSimpleReference.isEqualTo(simpleReference);
220
220
 
221
- if (judgementMetavariableEqualToMetavariable) {
221
+ if (judgementSimpleReferenceEqualToSimpleReference) {
222
222
  return true;
223
223
  }
224
224
  }
@@ -272,8 +272,8 @@ class LocalContext {
272
272
 
273
273
  isMetavariablePresentByMetavariableName(metavariableNode) { return this.context.isMetavariablePresentByMetavariableName(metavariableNode); }
274
274
 
275
- isJudgementPresentByMetavariable(metavariable) {
276
- const judgement = this.findJudgementByMetavariable(metavariable),
275
+ isJudgementPresentBySimpleReference(simpleReference) {
276
+ const judgement = this.findJudgementBySimpleReference(simpleReference),
277
277
  judgementPresent = (judgement !== null);
278
278
 
279
279
  return judgementPresent;
@@ -320,11 +320,11 @@ class LocalContext {
320
320
  return variableDefined;
321
321
  }
322
322
 
323
- isMetavariableDefined(metavariable) {
324
- const judgementPresent = this.isJudgementPresentByMetavariable(metavariable),
325
- metavariableDefined = judgementPresent; ///
323
+ isSimpleReferenceDefined(simpleReference) {
324
+ const judgementPresent = this.isJudgementPresentBySimpleReference(simpleReference),
325
+ simpleReferenceDefined = judgementPresent; ///
326
326
 
327
- return metavariableDefined
327
+ return simpleReferenceDefined
328
328
  }
329
329
 
330
330
  matchTermAndPropertyRelation(term, propertyRelation) {
@@ -227,16 +227,16 @@ function verifyWhenDerived(term, frame, negated, context) {
227
227
  }
228
228
 
229
229
  if (frame!== null) {
230
- const { Metavariable } = dom,
230
+ const { SimpleReference } = dom,
231
231
  frameNode = frame.getNode(),
232
- metavariable = Metavariable.fromFrameNode(frameNode, context),
233
- metavariableDefined = context.isMetavariableDefined(metavariable);
232
+ simpleReference = SimpleReference.fromFrameNode(frameNode, context),
233
+ simpleReferenceDefined = context.isSimpleReferenceDefined(simpleReference);
234
234
 
235
- if (!negated && metavariableDefined) {
235
+ if (!negated && simpleReferenceDefined) {
236
236
  verifiesWhenDerived = true;
237
237
  }
238
238
 
239
- if (negated && !metavariableDefined) {
239
+ if (negated && !simpleReferenceDefined) {
240
240
  verifiesWhenDerived = true;
241
241
  }
242
242
  }
@@ -7,11 +7,11 @@ import { domAssigned } from "../dom";
7
7
  import { unifyStatementIntrinsically } from "../utilities/unification";
8
8
 
9
9
  export default domAssigned(class Declaration {
10
- constructor(string, node, metavariable, statement) {
10
+ constructor(string, node, statement, simpleReference) {
11
11
  this.string = string;
12
12
  this.node = node;
13
- this.metavariable = metavariable;
14
13
  this.statement = statement;
14
+ this.simpleReference = simpleReference;
15
15
  }
16
16
 
17
17
  getString() {
@@ -22,14 +22,14 @@ export default domAssigned(class Declaration {
22
22
  return this.node;
23
23
  }
24
24
 
25
- getMetavariable() {
26
- return this.metavariable;
27
- }
28
-
29
25
  getStatement() {
30
26
  return this.statement;
31
27
  }
32
28
 
29
+ getSimpleReference() {
30
+ return this.simpleReference;
31
+ }
32
+
33
33
  isSimple() {
34
34
  const simple = (this.statement === null);
35
35
 
@@ -47,7 +47,7 @@ export default domAssigned(class Declaration {
47
47
  const simple = this.isSimple();
48
48
 
49
49
  if (simple) {
50
- const judgement = context.findJudgementByMetavariable(this.metavariable);
50
+ const judgement = context.findJudgementBySimpleReference(this.simpleReference);
51
51
 
52
52
  if (judgement !== null) {
53
53
  const declaration = judgement.getDeclaration();
@@ -56,9 +56,9 @@ export default domAssigned(class Declaration {
56
56
  }
57
57
  } else {
58
58
  const statement = substitution.getStatement(),
59
- metavariable = substitution.getMetavariable(),
59
+ simpleReference = substitution.getMetavariable(),
60
60
  statementEqualToStatement = this.statement.isEqualTo(statement),
61
- metavariableEqualToMetavariable = this.metavariable.isEqualTo(metavariable);
61
+ metavariableEqualToMetavariable = this.simpleReference.isEqualTo(simpleReference);
62
62
 
63
63
  if (metavariableEqualToMetavariable && statementEqualToStatement) {
64
64
  substitutionMatches = true;
@@ -119,17 +119,17 @@ export default domAssigned(class Declaration {
119
119
  let metavariableVerifiesAsReference;
120
120
 
121
121
  const declarationString = this.string,
122
- metavariableString = this.metavariable.getString();
122
+ metavariableString = this.simpleReference.getString();
123
123
 
124
- context.trace(`Verifying the '${declarationString}' declaration's '${metavariableString}' metavariable as a reference...`);
124
+ context.trace(`Verifying the '${declarationString}' declaration's '${metavariableString}' simpleReference as a reference...`);
125
125
 
126
- const reference = referenceFromMetavariable(this.metavariable, context),
126
+ const reference = referenceFromMetavariable(this.simpleReference, context),
127
127
  referenceVerifies = reference.verify(context);
128
128
 
129
129
  metavariableVerifiesAsReference = referenceVerifies; ///
130
130
 
131
131
  if (metavariableVerifiesAsReference) {
132
- context.debug(`...verified the '${declarationString}' declaration's '${metavariableString}' metavariable as a reference.`);
132
+ context.debug(`...verified the '${declarationString}' declaration's '${metavariableString}' simpleReference as a reference.`);
133
133
  }
134
134
 
135
135
  return metavariableVerifiesAsReference;
@@ -163,14 +163,14 @@ export default domAssigned(class Declaration {
163
163
  let verifiesAsMetavariable;
164
164
 
165
165
  const declarationString = this.string, ///
166
- metavariableString = this.metavariable.getString();
166
+ metavariableString = this.simpleReference.getString();
167
167
 
168
- context.trace(`Verifying the '${declarationString}' declaration's '${metavariableString}' metavariable...`);
168
+ context.trace(`Verifying the '${declarationString}' declaration's '${metavariableString}' simpleReference...`);
169
169
 
170
- verifiesAsMetavariable = this.metavariable.verify(context);
170
+ verifiesAsMetavariable = this.simpleReference.verify(context);
171
171
 
172
172
  if (verifiesAsMetavariable) {
173
- context.debug(`...verified the '${declarationString}' declaration's '${metavariableString}' metavariable.`);
173
+ context.debug(`...verified the '${declarationString}' declaration's '${metavariableString}' simpleReference.`);
174
174
  }
175
175
 
176
176
  return verifiesAsMetavariable;
@@ -183,7 +183,7 @@ export default domAssigned(class Declaration {
183
183
 
184
184
  context.trace(`Verifying the '${declarationString}' stated declaration...`);
185
185
 
186
- const reference = referenceFromMetavariable(this.metavariable, context),
186
+ const reference = referenceFromMetavariable(this.simpleReference, context),
187
187
  metavariablePresent = context.isMetavariablePresentByReference(reference);
188
188
 
189
189
  if (metavariablePresent) {
@@ -215,7 +215,7 @@ export default domAssigned(class Declaration {
215
215
 
216
216
  context.trace(`Verifying the '${declarationString}' derived declaration...`);
217
217
 
218
- const reference = referenceFromMetavariable(this.metavariable, context),
218
+ const reference = referenceFromMetavariable(this.simpleReference, context),
219
219
  metaLemmaMetatheoremPresent = context.isMetaLemmaMetatheoremPresentByReference(reference);
220
220
 
221
221
  verifiesWhenDerived = metaLemmaMetatheoremPresent; ///
@@ -264,7 +264,7 @@ export default domAssigned(class Declaration {
264
264
 
265
265
  context.trace(`Unifying the '${labelString}' label with the '${declarationString}' declaration...`);
266
266
 
267
- const reference = referenceFromMetavariable(this.metavariable, context),
267
+ const reference = referenceFromMetavariable(this.simpleReference, context),
268
268
  labelUnifies = reference.unifyLabel(label, substitutions, context);
269
269
 
270
270
  labelUnifiesWithReference = labelUnifies; ///
@@ -332,9 +332,9 @@ export default domAssigned(class Declaration {
332
332
  }
333
333
  });
334
334
 
335
- function referenceFromMetavariable(metavariable, context) {
335
+ function referenceFromMetavariable(simpleReference, context) {
336
336
  const { Reference } = dom,
337
- metavariableNode = metavariable.getNode(),
337
+ metavariableNode = simpleReference.getNode(),
338
338
  reference = Reference.fromMetavariableNode(metavariableNode, context);
339
339
 
340
340
  return reference;
@@ -344,9 +344,9 @@ function declarationFromDeclarationNode(declarationNode, context) {
344
344
  const { Metavariable, Declaration, Statement } = dom,
345
345
  node = declarationNode, ///
346
346
  string = context.nodeAsString(node),
347
- metavariable = Metavariable.fromDeclarationNode(declarationNode, context),
347
+ simpleReference = Metavariable.fromDeclarationNode(declarationNode, context),
348
348
  statement = Statement.fromDeclarationNode(declarationNode, context),
349
- declaration = new Declaration(string, node, metavariable, statement);
349
+ declaration = new Declaration(string, node, statement, simpleReference);
350
350
 
351
351
  return declaration;
352
352
  }
@@ -494,6 +494,27 @@ export default domAssigned(class Metavariable {
494
494
  return metavariable;
495
495
  }
496
496
 
497
+ static fromSimpleReferenceNode(simpleReferenceNode, context) {
498
+ const { Metavariable } = dom;
499
+
500
+ let node;
501
+
502
+ const type = null,
503
+ name = simpleReferenceNode.getName();
504
+
505
+ node = simpleReferenceNode; ///
506
+
507
+ const string = context.nodeAsString(node),
508
+ tokens = context.nodeAsTokens(node),
509
+ metaType = null;
510
+
511
+ node = null;
512
+
513
+ const metavariable = new Metavariable(string, node, tokens, name, type, metaType);
514
+
515
+ return metavariable;
516
+ }
517
+
497
518
  static fromMetavariableDeclarationNode(metavariableDeclarationNode, context) {
498
519
  const { MetaType } = dom,
499
520
  metavariableNode = metavariableDeclarationNode.getMetavariableNode(),
@@ -214,8 +214,8 @@ export default domAssigned(class Reference {
214
214
  }
215
215
 
216
216
  static fromSatisfiesAssertionNode(satisfiesAssertionNode, context) {
217
- const metavariableNode = satisfiesAssertionNode.getMetavariableNode(),
218
- reference = referenceFromMetavariableNode(metavariableNode, context);
217
+ const simpleReferenceNode = satisfiesAssertionNode.getSimpleReferenceNode(),
218
+ reference = referenceFromSimpleReferenceNode(simpleReferenceNode, context);
219
219
 
220
220
  return reference;
221
221
  }
@@ -234,5 +234,13 @@ function referenceFromMetavariableNode(metavariableNode, context) {
234
234
  metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
235
235
  reference = new Reference(metavariable);
236
236
 
237
+ return reference;
238
+ }
239
+
240
+ function referenceFromSimpleReferenceNode(simpleReferenceNode, context) {
241
+ const { Reference, Metavariable } = dom,
242
+ metavariable = Metavariable.fromSimpleReferenceNode(simpleReferenceNode, context),
243
+ reference = new Reference(metavariable);
244
+
237
245
  return reference;
238
246
  }
package/src/index.js CHANGED
@@ -39,6 +39,7 @@ import Metavariable from "./dom/metavariable";
39
39
  import ProcedureCall from "./dom/procedureCall";
40
40
  import SubDerivation from "./dom/subDerivation";
41
41
  import TypeAssertion from "./dom/assertion/type";
42
+ import SimpleReference from "./dom/simpleReference";
42
43
  import DefinedAssertion from "./dom/assertion/defined";
43
44
  import PropertyRelation from "./dom/propertyRelation";
44
45
  import TermSubstitution from "./dom/substitution/term";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import NonTerminalNode from "../../node/nonTerminal";
4
4
 
5
- import { SIGNATURE_RULE_NAME, METAVARIABLE_RULE_NAME } from "../../ruleNames";
5
+ import { SIGNATURE_RULE_NAME, SIMPLE_REFERENCE_RULE_NAME } from "../../ruleNames";
6
6
 
7
7
  export default class SatisfiesAssertionNode extends NonTerminalNode {
8
8
  getSignatureNode() {
@@ -12,11 +12,11 @@ export default class SatisfiesAssertionNode extends NonTerminalNode {
12
12
  return signatureNode;
13
13
  }
14
14
 
15
- getMetavariableNode() {
16
- const ruleName = METAVARIABLE_RULE_NAME,
17
- metavariableNode = this.getNodeByRuleName(ruleName);
15
+ getSimpleReferenceNode() {
16
+ const ruleName = SIMPLE_REFERENCE_RULE_NAME,
17
+ simpleReferenceNode = this.getNodeByRuleName(ruleName);
18
18
 
19
- return metavariableNode;
19
+ return simpleReferenceNode;
20
20
  }
21
21
 
22
22
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(SatisfiesAssertionNode, ruleName, childNodes, opacity, precedence); }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import NonTerminalNode from "../node/nonTerminal";
4
+
5
+ import { METAVARIABLE_RULE_NAME } from "../ruleNames";
6
+
7
+ export default class SimpleReferenceNode extends NonTerminalNode {
8
+ getMetavariableNode() {
9
+ const ruleName = METAVARIABLE_RULE_NAME,
10
+ metavariableNode = this.getNodeByRuleName(ruleName);
11
+
12
+ return metavariableNode;
13
+ }
14
+
15
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(SimpleReferenceNode, ruleName, childNodes, opacity, precedence); }
16
+ }
@@ -57,6 +57,7 @@ import TypeAssertionNode from "./node/assertion/type";
57
57
  import ConjectureBodyNode from "./node/body/conjecture";
58
58
  import MetatheoremBodyNode from "./node/body/metatheorem";
59
59
  import MetaLemmaHeaderNode from "./node/header/metaLemma";
60
+ import SimpleReferenceNode from "./node/simpleReference";
60
61
  import PropertyRelationNode from "./node/propertyRelation"
61
62
  import DefinedAssertionNode from "./node/assertion/defined";
62
63
  import TermSubstitutionNode from "./node/substitution/term";
@@ -135,6 +136,7 @@ import { RULE_RULE_NAME,
135
136
  CONJECTURE_BODY_RULE_NAME,
136
137
  META_LEMMA_BODY_RULE_NAME,
137
138
  METATHEOREM_BODY_RULE_NAME,
139
+ SIMPLE_REFERENCE_RULE_NAME,
138
140
  CONJECTURE_HEADER_RULE_NAME,
139
141
  META_LEMMA_HEADER_RULE_NAME,
140
142
  PROPERTY_RELATION_RULE_NAME,
@@ -214,6 +216,7 @@ const NonTerminalNodeMap = {
214
216
  [THEOREM_HEADER_RULE_NAME]: TheoremHeaderNode,
215
217
  [META_LEMMA_BODY_RULE_NAME]: MetaLemmaBodyNode,
216
218
  [CONJECTURE_BODY_RULE_NAME]: ConjectureBodyNode,
219
+ [SIMPLE_REFERENCE_RULE_NAME]: SimpleReferenceNode,
217
220
  [METATHEOREM_BODY_RULE_NAME]: MetatheoremBodyNode,
218
221
  [META_LEMMA_HEADER_RULE_NAME]: MetaLemmaHeaderNode,
219
222
  [CONJECTURE_HEADER_RULE_NAME]: ConjectureHeaderNode,
package/src/ruleNames.js CHANGED
@@ -56,6 +56,7 @@ export const THEOREM_HEADER_RULE_NAME = "theoremHeader";
56
56
  export const META_LEMMA_BODY_RULE_NAME = "metaLemmaBody";
57
57
  export const CONJECTURE_BODY_RULE_NAME = "conjectureBody";
58
58
  export const METATHEOREM_BODY_RULE_NAME = "metatheoremBody";
59
+ export const SIMPLE_REFERENCE_RULE_NAME = "simpleReference";
59
60
  export const META_LEMMA_HEADER_RULE_NAME = "metaLemmaHeader";
60
61
  export const PROPERTY_RELATION_RULE_NAME = "propertyRelation";
61
62
  export const DEFINED_ASSERTION_RULE_NAME = "definedAssertion";