occam-verify-cli 1.0.438 → 1.0.448
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 +42 -39
- package/lib/context/local.js +34 -34
- package/lib/context/release.js +3 -7
- package/lib/context/temporary.js +26 -26
- package/lib/element/assertion/contained.js +45 -45
- package/lib/element/assertion/defined.js +13 -13
- package/lib/element/assertion/property.js +23 -22
- package/lib/element/assertion/satisfies.js +7 -6
- package/lib/element/assertion/subproof.js +20 -17
- package/lib/element/assertion/type.js +3 -2
- package/lib/element/assertion.js +1 -23
- package/lib/element/assumption.js +24 -22
- package/lib/element/axiom.js +27 -30
- package/lib/element/axiomLemmaTheoremConjecture.js +50 -57
- package/lib/element/{statement/combinator → combinator}/bracketed.js +16 -16
- package/lib/element/combinator.js +229 -0
- package/lib/element/conclusion.js +11 -9
- package/lib/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/lib/element/constructor.js +232 -0
- package/lib/element/declaration/combinator.js +2 -16
- package/lib/element/declaration/complexType.js +12 -12
- package/lib/element/declaration/constructor.js +13 -11
- package/lib/element/declaration/simpleType.js +4 -4
- package/lib/element/declaration/typePrefix.js +2 -2
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +11 -9
- package/lib/element/derivation.js +17 -20
- package/lib/element/equivalence.js +10 -10
- package/lib/element/equivalences.js +5 -5
- package/lib/element/frame.js +32 -38
- package/lib/element/hypothesis.js +16 -57
- package/lib/element/judgement.js +6 -4
- package/lib/element/label.js +8 -8
- package/lib/element/metaLemmaMetatheorem.js +6 -39
- package/lib/element/metaType.js +17 -80
- package/lib/element/metavariable.js +38 -34
- package/lib/element/parameter.js +3 -3
- package/lib/element/premise.js +92 -174
- package/lib/element/proof.js +7 -7
- package/lib/element/proofAssertion.js +203 -0
- package/lib/element/property.js +9 -9
- package/lib/element/propertyRelation.js +13 -13
- package/lib/element/reference.js +16 -17
- package/lib/element/rule.js +46 -46
- package/lib/element/signature.js +11 -11
- package/lib/element/statement.js +18 -18
- package/lib/element/step.js +73 -124
- package/lib/element/subDerivation.js +17 -20
- package/lib/element/subproof.js +16 -24
- package/lib/element/substitution/frame.js +1 -7
- package/lib/element/substitution/reference.js +2 -3
- package/lib/element/substitution/statement.js +44 -15
- package/lib/element/substitution/term.js +10 -57
- package/lib/element/substitution.js +5 -11
- package/lib/element/substitutions.js +29 -29
- package/lib/element/supposition.js +95 -177
- package/lib/element/term.js +21 -34
- package/lib/element/type.js +47 -60
- package/lib/element/typePrefix.js +5 -5
- package/lib/element/variable.js +9 -9
- package/lib/element.js +9 -3
- package/lib/metaTypes.js +63 -0
- package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
- package/lib/node/body/axiom.js +2 -25
- package/lib/node/body/conjecture.js +2 -25
- package/lib/node/body/lemma.js +2 -25
- package/lib/node/body/metaLemma.js +2 -25
- package/lib/node/body/metatheorem.js +2 -25
- package/lib/node/body/rule.js +15 -1
- package/lib/node/body/theorem.js +2 -25
- package/lib/node/body.js +25 -2
- package/lib/node/combinator.js +11 -2
- package/lib/node/constructor.js +11 -2
- package/lib/node/declaration/combinator.js +5 -5
- package/lib/node/declaration/constructor.js +8 -8
- package/lib/node/declaration/property.js +15 -15
- package/lib/node/declaration/simpleType.js +31 -31
- package/lib/node/declaration/variable.js +8 -8
- package/lib/node/equality.js +8 -8
- package/lib/node/frame.js +20 -20
- package/lib/node/header.js +22 -22
- package/lib/node/metaLemmaMetaTheorem.js +16 -16
- package/lib/node/metavariable.js +15 -15
- package/lib/node/property.js +8 -8
- package/lib/node/propertyRelation.js +8 -8
- package/lib/node/rule.js +16 -16
- package/lib/node/statement.js +12 -12
- package/lib/node/step.js +22 -22
- package/lib/node/subDerivation.js +1 -8
- package/lib/node/subproof.js +5 -12
- package/lib/node/substitution/frame.js +19 -19
- package/lib/node/substitution/statement.js +19 -19
- package/lib/node/substitution/term.js +19 -19
- package/lib/node/term.js +35 -35
- package/lib/preamble.js +5 -5
- package/lib/process/instantiate.js +20 -2
- package/lib/process/unify.js +39 -42
- package/lib/process/validate.js +431 -0
- package/lib/process/verify.js +44 -135
- package/lib/types.js +27 -0
- package/lib/utilities/brackets.js +9 -14
- package/lib/utilities/element.js +91 -55
- package/lib/utilities/instance.js +41 -28
- package/lib/utilities/statement.js +2 -2
- package/lib/utilities/string.js +25 -14
- package/lib/utilities/unification.js +237 -0
- package/lib/utilities/validation.js +251 -0
- package/package.json +6 -6
- package/src/context/file.js +40 -34
- package/src/context/local.js +34 -34
- package/src/context/release.js +2 -6
- package/src/context/temporary.js +15 -15
- package/src/element/assertion/contained.js +19 -20
- package/src/element/assertion/defined.js +11 -12
- package/src/element/assertion/property.js +20 -20
- package/src/element/assertion/satisfies.js +6 -6
- package/src/element/assertion/subproof.js +17 -15
- package/src/element/assertion/type.js +2 -2
- package/src/element/assertion.js +0 -2
- package/src/element/assumption.js +22 -19
- package/src/element/axiom.js +33 -37
- package/src/element/axiomLemmaTheoremConjecture.js +54 -73
- package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
- package/src/element/combinator.js +90 -0
- package/src/element/conclusion.js +12 -10
- package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/src/element/{term/constructor.js → constructor.js} +17 -25
- package/src/element/declaration/combinator.js +1 -22
- package/src/element/declaration/complexType.js +11 -11
- package/src/element/declaration/constructor.js +13 -10
- package/src/element/declaration/simpleType.js +3 -3
- package/src/element/declaration/typePrefix.js +1 -1
- package/src/element/declaration/variable.js +2 -2
- package/src/element/deduction.js +12 -9
- package/src/element/derivation.js +15 -19
- package/src/element/equivalence.js +8 -8
- package/src/element/equivalences.js +4 -4
- package/src/element/frame.js +28 -30
- package/src/element/hypothesis.js +16 -18
- package/src/element/judgement.js +6 -3
- package/src/element/label.js +4 -4
- package/src/element/metaLemmaMetatheorem.js +5 -69
- package/src/element/metaType.js +9 -45
- package/src/element/metavariable.js +34 -31
- package/src/element/parameter.js +2 -2
- package/src/element/premise.js +124 -99
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion.js +76 -0
- package/src/element/property.js +6 -6
- package/src/element/propertyRelation.js +11 -11
- package/src/element/reference.js +14 -21
- package/src/element/rule.js +39 -38
- package/src/element/signature.js +10 -9
- package/src/element/statement.js +16 -18
- package/src/element/step.js +78 -78
- package/src/element/subDerivation.js +15 -19
- package/src/element/subproof.js +11 -19
- package/src/element/substitution/frame.js +0 -2
- package/src/element/substitution/reference.js +1 -5
- package/src/element/substitution/statement.js +44 -14
- package/src/element/substitution/term.js +10 -13
- package/src/element/substitution.js +3 -5
- package/src/element/substitutions.js +48 -30
- package/src/element/supposition.js +127 -108
- package/src/element/term.js +18 -28
- package/src/element/type.js +42 -36
- package/src/element/typePrefix.js +3 -3
- package/src/element/variable.js +7 -7
- package/src/element.js +3 -1
- package/src/metaTypes.js +55 -0
- package/src/node/axiomLemmaTheoremConjecture.js +6 -6
- package/src/node/body/axiom.js +0 -21
- package/src/node/body/conjecture.js +0 -23
- package/src/node/body/lemma.js +0 -23
- package/src/node/body/metaLemma.js +0 -23
- package/src/node/body/metatheorem.js +0 -23
- package/src/node/body/rule.js +12 -0
- package/src/node/body/theorem.js +0 -23
- package/src/node/body.js +23 -0
- package/src/node/combinator.js +9 -0
- package/src/node/constructor.js +9 -0
- package/src/node/declaration/combinator.js +5 -5
- package/src/node/declaration/constructor.js +8 -8
- package/src/node/declaration/property.js +14 -14
- package/src/node/declaration/simpleType.js +31 -31
- package/src/node/declaration/variable.js +7 -7
- package/src/node/equality.js +7 -7
- package/src/node/frame.js +21 -21
- package/src/node/header.js +22 -22
- package/src/node/metaLemmaMetaTheorem.js +14 -14
- package/src/node/metavariable.js +14 -14
- package/src/node/property.js +7 -7
- package/src/node/propertyRelation.js +7 -7
- package/src/node/rule.js +15 -15
- package/src/node/statement.js +12 -12
- package/src/node/step.js +21 -21
- package/src/node/subDerivation.js +0 -7
- package/src/node/subproof.js +4 -11
- package/src/node/substitution/frame.js +18 -18
- package/src/node/substitution/statement.js +18 -18
- package/src/node/substitution/term.js +18 -18
- package/src/node/term.js +34 -34
- package/src/preamble.js +4 -4
- package/src/process/instantiate.js +12 -0
- package/src/process/unify.js +53 -57
- package/src/process/validate.js +316 -0
- package/src/process/verify.js +50 -138
- package/src/types.js +18 -0
- package/src/utilities/brackets.js +15 -14
- package/src/utilities/element.js +125 -82
- package/src/utilities/instance.js +42 -24
- package/src/utilities/statement.js +2 -2
- package/src/utilities/string.js +38 -24
- package/src/{mixins/step/unify.js → utilities/unification.js} +99 -85
- package/src/{mixins/statement/validate.js → utilities/validation.js} +143 -69
- package/lib/element/statement/combinator.js +0 -105
- package/lib/element/term/constructor.js +0 -172
- package/lib/mixins/statement/validate.js +0 -198
- package/lib/mixins/step/unify.js +0 -228
- package/lib/mixins/term/verify.js +0 -65
- package/src/element/statement/combinator.js +0 -59
- package/src/mixins/term/verify.js +0 -81
package/src/context/file.js
CHANGED
|
@@ -4,8 +4,8 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import elements from "../elements";
|
|
6
6
|
|
|
7
|
-
import { baseType } from "../element/type";
|
|
8
7
|
import { verifyFile } from "../process/verify";
|
|
8
|
+
import { baseTypeFromNothing } from "../types";
|
|
9
9
|
import { nodeAsString, nodesAsString } from "../utilities/node";
|
|
10
10
|
import { typesFromJSON,
|
|
11
11
|
rulesFromJSON,
|
|
@@ -97,10 +97,10 @@ export default class FileContext {
|
|
|
97
97
|
return equivalences;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
const
|
|
100
|
+
getSubproofOrProofAssertions() {
|
|
101
|
+
const subproofOrProofAssertions = [];
|
|
102
102
|
|
|
103
|
-
return
|
|
103
|
+
return subproofOrProofAssertions;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
getLabels(includeRelease = true) {
|
|
@@ -329,9 +329,9 @@ export default class FileContext {
|
|
|
329
329
|
findMetaLemmaByReference(reference) {
|
|
330
330
|
const metaLemmas = this.getMetaLemmas(),
|
|
331
331
|
metaLemma = metaLemmas.find((metaLemma) => {
|
|
332
|
-
const
|
|
332
|
+
const metaLemmaComparesToReference = metaLemma.compareReference(reference);
|
|
333
333
|
|
|
334
|
-
if (
|
|
334
|
+
if (metaLemmaComparesToReference) {
|
|
335
335
|
return true;
|
|
336
336
|
}
|
|
337
337
|
}) || null;
|
|
@@ -342,9 +342,9 @@ export default class FileContext {
|
|
|
342
342
|
findMetatheoremByReference(reference) {
|
|
343
343
|
const metatheorems = this.getMetatheorems(),
|
|
344
344
|
metatheorem = metatheorems.find((metatheorem) => {
|
|
345
|
-
const
|
|
345
|
+
const metatheoremComparesToReference = metatheorem.compareReference(reference);
|
|
346
346
|
|
|
347
|
-
if (
|
|
347
|
+
if (metatheoremComparesToReference) {
|
|
348
348
|
return true;
|
|
349
349
|
}
|
|
350
350
|
}) || null;
|
|
@@ -356,9 +356,9 @@ export default class FileContext {
|
|
|
356
356
|
const rules = this.getRules(),
|
|
357
357
|
metavariableName = reference.getMetavariableName(),
|
|
358
358
|
rule = rules.find((rule) => {
|
|
359
|
-
const
|
|
359
|
+
const ruleComparesToMetavariableName = rule.compareMetavariableName(metavariableName);
|
|
360
360
|
|
|
361
|
-
if (
|
|
361
|
+
if (ruleComparesToMetavariableName) {
|
|
362
362
|
return true;
|
|
363
363
|
}
|
|
364
364
|
}) || null;
|
|
@@ -370,9 +370,9 @@ export default class FileContext {
|
|
|
370
370
|
const axioms = this.getAxioms(),
|
|
371
371
|
metavariableName = reference.getMetavariableName(),
|
|
372
372
|
axiom = axioms.find((axiom) => {
|
|
373
|
-
const
|
|
373
|
+
const axiomComparesToMetavariableName = axiom.compareMetavariableName(metavariableName);
|
|
374
374
|
|
|
375
|
-
if (
|
|
375
|
+
if (axiomComparesToMetavariableName) {
|
|
376
376
|
return true;
|
|
377
377
|
}
|
|
378
378
|
}) || null;
|
|
@@ -384,9 +384,9 @@ export default class FileContext {
|
|
|
384
384
|
const lemmas = this.getLemmas(),
|
|
385
385
|
metavariableName = reference.getMetavariableName(),
|
|
386
386
|
lemma = lemmas.find((lemma) => {
|
|
387
|
-
const
|
|
387
|
+
const lemmaComparesToMetavariableName = lemma.compareMetavariableName(metavariableName);
|
|
388
388
|
|
|
389
|
-
if (
|
|
389
|
+
if (lemmaComparesToMetavariableName) {
|
|
390
390
|
return true;
|
|
391
391
|
}
|
|
392
392
|
}) || null;
|
|
@@ -398,9 +398,9 @@ export default class FileContext {
|
|
|
398
398
|
const theorems = this.getTheorems(),
|
|
399
399
|
metavariableName = reference.getMetavariableName(),
|
|
400
400
|
theorem = theorems.find((theorem) => {
|
|
401
|
-
const
|
|
401
|
+
const theoremComparesToMetavariableName = theorem.compareMetavariableName(metavariableName);
|
|
402
402
|
|
|
403
|
-
if (
|
|
403
|
+
if (theoremComparesToMetavariableName) {
|
|
404
404
|
return true;
|
|
405
405
|
}
|
|
406
406
|
}) || null;
|
|
@@ -425,9 +425,9 @@ export default class FileContext {
|
|
|
425
425
|
const conjectures = this.getConjectures(),
|
|
426
426
|
metavariableName = reference.getMetavariableName(),
|
|
427
427
|
conjecture = conjectures.find((conjecture) => {
|
|
428
|
-
const
|
|
428
|
+
const conjectureComparesToMetavariableName = conjecture.compareMetavariableName(metavariableName);
|
|
429
429
|
|
|
430
|
-
if (
|
|
430
|
+
if (conjectureComparesToMetavariableName) {
|
|
431
431
|
return true;
|
|
432
432
|
}
|
|
433
433
|
}) || null;
|
|
@@ -519,15 +519,17 @@ export default class FileContext {
|
|
|
519
519
|
findTypeByTypeName(typeName, includeRelease = true, includeDependencies = true) {
|
|
520
520
|
let types = this.getTypes(includeRelease, includeDependencies);
|
|
521
521
|
|
|
522
|
+
const baseType = baseTypeFromNothing();
|
|
523
|
+
|
|
522
524
|
types = [
|
|
523
525
|
...types,
|
|
524
526
|
baseType
|
|
525
527
|
];
|
|
526
528
|
|
|
527
529
|
const type = types.find((type) => {
|
|
528
|
-
const
|
|
530
|
+
const typeComparesToTypeName = type.compareTypeName(typeName);
|
|
529
531
|
|
|
530
|
-
if (
|
|
532
|
+
if (typeComparesToTypeName) {
|
|
531
533
|
return true;
|
|
532
534
|
}
|
|
533
535
|
}) || null;
|
|
@@ -538,15 +540,17 @@ export default class FileContext {
|
|
|
538
540
|
findTypeByNominalTypeName(nominalTypeName) {
|
|
539
541
|
let types = this.getTypes();
|
|
540
542
|
|
|
543
|
+
const baseType = baseTypeFromNothing();
|
|
544
|
+
|
|
541
545
|
types = [
|
|
542
546
|
...types,
|
|
543
547
|
baseType
|
|
544
548
|
];
|
|
545
549
|
|
|
546
550
|
const type = types.find((type) => {
|
|
547
|
-
const
|
|
551
|
+
const typeComparesToNominalTypeName = type.compareNominalTypeName(nominalTypeName);
|
|
548
552
|
|
|
549
|
-
if (
|
|
553
|
+
if (typeComparesToNominalTypeName) {
|
|
550
554
|
return true;
|
|
551
555
|
}
|
|
552
556
|
}) || null;
|
|
@@ -557,15 +561,17 @@ export default class FileContext {
|
|
|
557
561
|
findTypeByPrefixedTypeName(prefixedTypeName) {
|
|
558
562
|
let types = this.getTypes();
|
|
559
563
|
|
|
564
|
+
const baseType = baseTypeFromNothing();
|
|
565
|
+
|
|
560
566
|
types = [
|
|
561
567
|
...types,
|
|
562
568
|
baseType
|
|
563
569
|
];
|
|
564
570
|
|
|
565
571
|
const type = types.find((type) => {
|
|
566
|
-
const
|
|
572
|
+
const typeComparesToPrefixedTypeName = type.comparePrefixedTypeName(prefixedTypeName);
|
|
567
573
|
|
|
568
|
-
if (
|
|
574
|
+
if (typeComparesToPrefixedTypeName) {
|
|
569
575
|
return true;
|
|
570
576
|
}
|
|
571
577
|
}) || null;
|
|
@@ -576,9 +582,9 @@ export default class FileContext {
|
|
|
576
582
|
findMetaTypeByMetaTypeName(metaTypeName) {
|
|
577
583
|
const metaTypes = this.getMetaTypes(),
|
|
578
584
|
metaType = metaTypes.find((metaType) => {
|
|
579
|
-
const
|
|
585
|
+
const metaTypeComparesToMetaTypeName = metaType.compareMetaTypeName(metaTypeName);
|
|
580
586
|
|
|
581
|
-
if (
|
|
587
|
+
if (metaTypeComparesToMetaTypeName) {
|
|
582
588
|
return true;
|
|
583
589
|
}
|
|
584
590
|
}) || null;
|
|
@@ -589,9 +595,9 @@ export default class FileContext {
|
|
|
589
595
|
findTypePrefixByTypePrefixName(typePrefixName) {
|
|
590
596
|
const typePrefixes = this.getTypePrefixes(),
|
|
591
597
|
typePrefix = typePrefixes.find((typePrefix) => {
|
|
592
|
-
const
|
|
598
|
+
const typePrefixComparesToTypePrefixName = typePrefix.compareTypePrefixName(typePrefixName);
|
|
593
599
|
|
|
594
|
-
if (
|
|
600
|
+
if (typePrefixComparesToTypePrefixName) {
|
|
595
601
|
return true;
|
|
596
602
|
}
|
|
597
603
|
}) || null;
|
|
@@ -602,9 +608,9 @@ export default class FileContext {
|
|
|
602
608
|
findVariableByVariableIdentifier(variableIdentifier) {
|
|
603
609
|
const variables = this.getVariables(),
|
|
604
610
|
variable = variables.find((variable) => {
|
|
605
|
-
const
|
|
611
|
+
const variableComparesToVariableIdentifier = variable.compareVariableIdentifier(variableIdentifier);
|
|
606
612
|
|
|
607
|
-
if (
|
|
613
|
+
if (variableComparesToVariableIdentifier) {
|
|
608
614
|
return true;
|
|
609
615
|
}
|
|
610
616
|
}) || null;
|
|
@@ -615,9 +621,9 @@ export default class FileContext {
|
|
|
615
621
|
findLabelByMetavariableName(metavariableName) {
|
|
616
622
|
const labels = this.getLabels(),
|
|
617
623
|
label = labels.find((label) => {
|
|
618
|
-
const
|
|
624
|
+
const labelComparesToMetavariableName = label.compareMetavariableName(metavariableName);
|
|
619
625
|
|
|
620
|
-
if (
|
|
626
|
+
if (labelComparesToMetavariableName) {
|
|
621
627
|
return true;
|
|
622
628
|
}
|
|
623
629
|
}) || null;
|
|
@@ -659,9 +665,9 @@ export default class FileContext {
|
|
|
659
665
|
findMetavariableByMetavariableName(metavariableName) {
|
|
660
666
|
const metavariables = this.getMetavariables(),
|
|
661
667
|
metavariable = metavariables.find((metavariable) => {
|
|
662
|
-
const
|
|
668
|
+
const metavariableComparesToMetavariableName = metavariable.compareMetavariableName(metavariableName);
|
|
663
669
|
|
|
664
|
-
if (
|
|
670
|
+
if (metavariableComparesToMetavariableName) {
|
|
665
671
|
return true;
|
|
666
672
|
}
|
|
667
673
|
}) || null;
|
package/src/context/local.js
CHANGED
|
@@ -7,12 +7,12 @@ import elements from "../elements";
|
|
|
7
7
|
const { last } = arrayUtilities;
|
|
8
8
|
|
|
9
9
|
class LocalContext {
|
|
10
|
-
constructor(context, variables, judgements, equivalences,
|
|
10
|
+
constructor(context, variables, judgements, equivalences, subproofOrProofAssertions) {
|
|
11
11
|
this.context = context;
|
|
12
12
|
this.variables = variables;
|
|
13
13
|
this.judgements = judgements;
|
|
14
14
|
this.equivalences = equivalences;
|
|
15
|
-
this.
|
|
15
|
+
this.subproofOrProofAssertions = subproofOrProofAssertions;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
getContext() {
|
|
@@ -55,41 +55,41 @@ class LocalContext {
|
|
|
55
55
|
return equivalences;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const
|
|
58
|
+
getProofAssertions() {
|
|
59
|
+
const subproofOrProofAssertions = this.getSubproofOrProofAssertions(),
|
|
60
|
+
proofAssertions = subproofOrProofAssertions.filter((subproofOrProofAssertion) => {
|
|
61
|
+
const subproofOrProofAssertionproofAssertion = subproofOrProofAssertion.isProofAssertion();
|
|
62
62
|
|
|
63
|
-
if (
|
|
63
|
+
if (subproofOrProofAssertionproofAssertion) {
|
|
64
64
|
return true;
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
return
|
|
68
|
+
return proofAssertions;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
let
|
|
71
|
+
getLastProofAssertion() {
|
|
72
|
+
let lastProofAssertion = null;
|
|
73
73
|
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const proofAssertions = this.getProofAssertions(),
|
|
75
|
+
proofAssertionsLength = proofAssertions.length;
|
|
76
76
|
|
|
77
|
-
if (
|
|
78
|
-
|
|
77
|
+
if (proofAssertionsLength > 0) {
|
|
78
|
+
lastProofAssertion = last(proofAssertions);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
return
|
|
81
|
+
return lastProofAssertion;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
let
|
|
84
|
+
getSubproofOrProofAssertions() {
|
|
85
|
+
let subproofOrProofAssertions = this.context.getSubproofOrProofAssertions();
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
...
|
|
89
|
-
...this.
|
|
87
|
+
subproofOrProofAssertions = [ ///
|
|
88
|
+
...subproofOrProofAssertions,
|
|
89
|
+
...this.subproofOrProofAssertions
|
|
90
90
|
];
|
|
91
91
|
|
|
92
|
-
return
|
|
92
|
+
return subproofOrProofAssertions;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
getFilePath() { return this.context.getFilePath(); }
|
|
@@ -187,8 +187,8 @@ class LocalContext {
|
|
|
187
187
|
return judgementAdded;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
this.
|
|
190
|
+
addSubproofOrProofAssertion(subproofOrProofAssertion) {
|
|
191
|
+
this.subproofOrProofAssertions.push(subproofOrProofAssertion);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
findProcedureByName(name) { return this.context.findProcedureByName(name); }
|
|
@@ -216,9 +216,9 @@ class LocalContext {
|
|
|
216
216
|
findVariableByVariableIdentifier(variableIdentifier, nested = true) {
|
|
217
217
|
const variables = this.getVariables(nested),
|
|
218
218
|
variable = variables.find((variable) => {
|
|
219
|
-
const
|
|
219
|
+
const variableComparesToVariableIdentifier = variable.compareVariableIdentifier(variableIdentifier);
|
|
220
220
|
|
|
221
|
-
if (
|
|
221
|
+
if (variableComparesToVariableIdentifier) {
|
|
222
222
|
return true;
|
|
223
223
|
}
|
|
224
224
|
}) || null;
|
|
@@ -306,7 +306,7 @@ class LocalContext {
|
|
|
306
306
|
|
|
307
307
|
const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
|
|
308
308
|
const groundedTermNode = groundedTerm.getNode(),
|
|
309
|
-
groundedTermNodeMatches = term.
|
|
309
|
+
groundedTermNodeMatches = term.matchNode(groundedTermNode);
|
|
310
310
|
|
|
311
311
|
if (groundedTermNodeMatches) {
|
|
312
312
|
return true;
|
|
@@ -344,18 +344,18 @@ class LocalContext {
|
|
|
344
344
|
return metavariableDefined
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
|
|
347
|
+
compareTermAndPropertyRelation(term, propertyRelation) {
|
|
348
348
|
const context = this, ///
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const
|
|
349
|
+
proofAssertions = this.getProofAssertions(),
|
|
350
|
+
comparesToTermAndPropertyRelation = proofAssertions.some((proofAssertion) => {
|
|
351
|
+
const comparesToTermAndPropertyRelation = proofAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
352
352
|
|
|
353
|
-
if (
|
|
353
|
+
if (comparesToTermAndPropertyRelation) {
|
|
354
354
|
return true;
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
357
|
|
|
358
|
-
return
|
|
358
|
+
return comparesToTermAndPropertyRelation;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
nodeAsString(node) { return this.context.nodeAsString(node); }
|
|
@@ -377,8 +377,8 @@ class LocalContext {
|
|
|
377
377
|
variables = [],
|
|
378
378
|
judgements = [],
|
|
379
379
|
equivalences = Equivalences.fromNothing(),
|
|
380
|
-
|
|
381
|
-
localContext = new LocalContext(context, variables, judgements, equivalences,
|
|
380
|
+
subproofOrProofAssertions = [],
|
|
381
|
+
localContext = new LocalContext(context, variables, judgements, equivalences, subproofOrProofAssertions);
|
|
382
382
|
|
|
383
383
|
return localContext;
|
|
384
384
|
}
|
package/src/context/release.js
CHANGED
|
@@ -10,7 +10,7 @@ import FileContext from "../context/file";
|
|
|
10
10
|
import NominalLexer from "../nominal/lexer";
|
|
11
11
|
import NominalParser from "../nominal/parser";
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { getMetaTypes } from "../metaTypes";
|
|
14
14
|
import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
|
|
15
15
|
|
|
16
16
|
const { nominalLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
@@ -58,11 +58,7 @@ export default class ReleaseContext {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
getMetaTypes() {
|
|
61
|
-
const metaTypes =
|
|
62
|
-
frameMetaType,
|
|
63
|
-
referenceMetaType,
|
|
64
|
-
statementMetaType
|
|
65
|
-
];
|
|
61
|
+
const metaTypes = getMetaTypes();
|
|
66
62
|
|
|
67
63
|
return metaTypes;
|
|
68
64
|
}
|
package/src/context/temporary.js
CHANGED
|
@@ -159,9 +159,9 @@ export default class TemporaryContext {
|
|
|
159
159
|
|
|
160
160
|
findTermByTermNode(termNode) {
|
|
161
161
|
const term = this.terms.find((term) => {
|
|
162
|
-
const
|
|
162
|
+
const termNodeMatches = term.matchNode(termNode);
|
|
163
163
|
|
|
164
|
-
if (
|
|
164
|
+
if (termNodeMatches) {
|
|
165
165
|
return true;
|
|
166
166
|
}
|
|
167
167
|
}) || null;
|
|
@@ -171,9 +171,9 @@ export default class TemporaryContext {
|
|
|
171
171
|
|
|
172
172
|
findFrameByFrameNode(frameNode) {
|
|
173
173
|
const frame = this.frames.find((frame) => {
|
|
174
|
-
const
|
|
174
|
+
const frameNodeMatches = frame.matchNode(frameNode);
|
|
175
175
|
|
|
176
|
-
if (
|
|
176
|
+
if (frameNodeMatches) {
|
|
177
177
|
return true;
|
|
178
178
|
}
|
|
179
179
|
}) || null;
|
|
@@ -183,9 +183,9 @@ export default class TemporaryContext {
|
|
|
183
183
|
|
|
184
184
|
findStatementByStatementNode(statementNode) {
|
|
185
185
|
const statement = this.statements.find((statement) => {
|
|
186
|
-
const
|
|
186
|
+
const statementNodeMatches = statement.matchNode(statementNode);
|
|
187
187
|
|
|
188
|
-
if (
|
|
188
|
+
if (statementNodeMatches) {
|
|
189
189
|
return true;
|
|
190
190
|
}
|
|
191
191
|
}) || null;
|
|
@@ -195,9 +195,9 @@ export default class TemporaryContext {
|
|
|
195
195
|
|
|
196
196
|
findAssertionByAssertionNode(assertionNode) {
|
|
197
197
|
const assertion = this.assertions.find((assertion) => {
|
|
198
|
-
const
|
|
198
|
+
const assertionNodeMatches = assertion.matchNode(assertionNode);
|
|
199
199
|
|
|
200
|
-
if (
|
|
200
|
+
if (assertionNodeMatches) {
|
|
201
201
|
return true;
|
|
202
202
|
}
|
|
203
203
|
}) || null;
|
|
@@ -219,9 +219,9 @@ export default class TemporaryContext {
|
|
|
219
219
|
|
|
220
220
|
findSubstitutionBySubstitutionNode(substitutionNode) {
|
|
221
221
|
const substitution = this.substitutions.find((substitution) => {
|
|
222
|
-
const
|
|
222
|
+
const substitutionNodeMatches = substitution.matchNode(substitutionNode);
|
|
223
223
|
|
|
224
|
-
if (
|
|
224
|
+
if (substitutionNodeMatches) {
|
|
225
225
|
return true;
|
|
226
226
|
}
|
|
227
227
|
}) || null;
|
|
@@ -235,11 +235,11 @@ export default class TemporaryContext {
|
|
|
235
235
|
|
|
236
236
|
getEquivalences() { return this.context.getEquivalences(); }
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
getProofAssertions() { return this.context.getProofAssertions(); }
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
getLastProofAssertion() { return this.context.getLastProofAssertion(); }
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
getSubproofOrProofAssertions() { return this.context.getSubproofOrProofAssertions(); }
|
|
243
243
|
|
|
244
244
|
getFilePath() { return this.context.getFilePath(); }
|
|
245
245
|
|
|
@@ -273,7 +273,7 @@ export default class TemporaryContext {
|
|
|
273
273
|
|
|
274
274
|
addJudgement(judgement) { return this.context.addJudgement(judgement); }
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
addSubproofOrProofAssertion(subproofOrProofAssertion) { this.context.addSubproofOrProofAssertion(subproofOrProofAssertion); }
|
|
277
277
|
|
|
278
278
|
findProcedureByName(name) { return this.context.findProcedureByName(name); }
|
|
279
279
|
|
|
@@ -349,7 +349,7 @@ export default class TemporaryContext {
|
|
|
349
349
|
|
|
350
350
|
isMetavariableDefined(metavariable) { return this.context.isMetavariableDefined(metavariable); }
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
compareTermAndPropertyRelation(term, propertyRelation) { return this.context.compareTermAndPropertyRelation(term, propertyRelation); }
|
|
353
353
|
|
|
354
354
|
nodeAsString(node) { return this.context.nodeAsString(node); }
|
|
355
355
|
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { containedAssertionFromStatementNode } from "../../utilities/element";
|
|
7
6
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
|
|
8
7
|
|
|
9
8
|
export default define(class ContainedAssertion extends Assertion {
|
|
10
|
-
constructor(string, node, term, frame, negated, statement) {
|
|
11
|
-
super(string, node);
|
|
9
|
+
constructor(cpontext, string, node, term, frame, negated, statement) {
|
|
10
|
+
super(context, string, node);
|
|
12
11
|
|
|
13
12
|
this.term = term;
|
|
14
13
|
this.frame = frame;
|
|
@@ -39,11 +38,11 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
39
38
|
|
|
40
39
|
context.trace(`Verifying the '${containedAssertionString}' contained assertion...`);
|
|
41
40
|
|
|
42
|
-
const
|
|
41
|
+
const termValidates = this.validateTerm(assignments, stated, context),
|
|
43
42
|
frameVerifies = this.verifyFrame(assignments, stated, context),
|
|
44
|
-
|
|
43
|
+
statementValidates = this.validateStatement(assignments, stated, context)
|
|
45
44
|
|
|
46
|
-
if (
|
|
45
|
+
if (termValidates || frameVerifies || statementValidates) {
|
|
47
46
|
let verifiesWhenStated = false,
|
|
48
47
|
verifiesWhenDerived = false;
|
|
49
48
|
|
|
@@ -65,32 +64,32 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
65
64
|
return verifies;
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
let
|
|
67
|
+
validateTerm(assignments, stated, context) {
|
|
68
|
+
let termValidates = false;
|
|
70
69
|
|
|
71
70
|
if (this.term !== null) {
|
|
72
71
|
const termString = this.term.getString();
|
|
73
72
|
|
|
74
|
-
context.trace(`
|
|
73
|
+
context.trace(`Validating the '${termString}' term...`);
|
|
75
74
|
|
|
76
75
|
const termSingular = this.term.isSingular();
|
|
77
76
|
|
|
78
77
|
if (!termSingular) {
|
|
79
78
|
context.debug(`The '${termString}' term is not singular.`);
|
|
80
79
|
} else {
|
|
81
|
-
|
|
80
|
+
termValidates = this.term.validate(context, () => {
|
|
82
81
|
const verifiesAhead = true;
|
|
83
82
|
|
|
84
83
|
return verifiesAhead;
|
|
85
84
|
});
|
|
86
85
|
|
|
87
|
-
if (
|
|
88
|
-
context.debug(`...
|
|
86
|
+
if (termValidates) {
|
|
87
|
+
context.debug(`...validated the '${termString}' term.`);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
return
|
|
92
|
+
return termValidates;
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
verifyFrame(assignments, stated, context) {
|
|
@@ -121,26 +120,26 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
121
120
|
return frameVerifies;
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
|
|
125
|
-
let
|
|
123
|
+
validateStatement(assignments, stated, context) {
|
|
124
|
+
let statementValidates = false;
|
|
126
125
|
|
|
127
126
|
if (this.statement !== null) {
|
|
128
127
|
const statementString = this.statement.getString();
|
|
129
128
|
|
|
130
|
-
context.trace(`
|
|
129
|
+
context.trace(`Validating the '${statementString}' statement...`);
|
|
131
130
|
|
|
132
131
|
stated = true; ///
|
|
133
132
|
|
|
134
133
|
assignments = null; ///
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
statementValidates = this.statement.validate(assignments, stated, context);
|
|
137
136
|
|
|
138
|
-
if (
|
|
139
|
-
context.debug(`...
|
|
137
|
+
if (statementValidates) {
|
|
138
|
+
context.debug(`...validated the '${statementString}' statement.`);
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
return
|
|
142
|
+
return statementValidates;
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
verifyWhenStated(assignments, context) {
|
|
@@ -4,12 +4,11 @@ import elements from "../../elements";
|
|
|
4
4
|
import Assertion from "../assertion";
|
|
5
5
|
|
|
6
6
|
import { define } from "../../elements";
|
|
7
|
-
import { definedAssertionFromStatementNode } from "../../utilities/element";
|
|
8
7
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
|
|
9
8
|
|
|
10
9
|
export default define(class DefinedAssertion extends Assertion {
|
|
11
|
-
constructor(string, node, term, frame, negated) {
|
|
12
|
-
super(string, node);
|
|
10
|
+
constructor(context, string, node, term, frame, negated) {
|
|
11
|
+
super(context, string, node);
|
|
13
12
|
|
|
14
13
|
this.term = term;
|
|
15
14
|
this.frame= frame;
|
|
@@ -35,10 +34,10 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
35
34
|
|
|
36
35
|
context.trace(`Verifying the '${definedAssertionString}' defined assertion...`);
|
|
37
36
|
|
|
38
|
-
const
|
|
37
|
+
const termValidates = this.validateTerm(assignments, stated, context),
|
|
39
38
|
frameVerifies = this.verifyFrame(assignments, stated, context);
|
|
40
39
|
|
|
41
|
-
if (
|
|
40
|
+
if (termValidates || frameVerifies) {
|
|
42
41
|
let verifiesWhenStated = false,
|
|
43
42
|
verifiesWhenDerived = false;
|
|
44
43
|
|
|
@@ -60,32 +59,32 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
60
59
|
return verifies;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
let
|
|
62
|
+
validateTerm(assignments, stated, context) {
|
|
63
|
+
let termValidates = false;
|
|
65
64
|
|
|
66
65
|
if (this.term !== null) {
|
|
67
66
|
const termString = this.term.getString(); ///
|
|
68
67
|
|
|
69
|
-
context.trace(`
|
|
68
|
+
context.trace(`Validating the '${termString}' term...`);
|
|
70
69
|
|
|
71
70
|
const termSingular = this.term.isSingular();
|
|
72
71
|
|
|
73
72
|
if (!termSingular) {
|
|
74
73
|
context.debug(`The '${termString}' term is not singular.`);
|
|
75
74
|
} else {
|
|
76
|
-
|
|
75
|
+
termValidates = this.term.validate(context, () => {
|
|
77
76
|
const verifiesAhead = true;
|
|
78
77
|
|
|
79
78
|
return verifiesAhead;
|
|
80
79
|
});
|
|
81
80
|
|
|
82
|
-
if (
|
|
83
|
-
context.debug(`...
|
|
81
|
+
if (termValidates) {
|
|
82
|
+
context.debug(`...validated the '${termString}' term.`);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
return
|
|
87
|
+
return termValidates;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
verifyFrame(assignments, stated, context) {
|