occam-verify-cli 1.0.650 → 1.0.655

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.
Files changed (97) hide show
  1. package/lib/action/verify.js +1 -2
  2. package/lib/context/ephemeral.js +42 -1
  3. package/lib/context/file/nominal.js +26 -33
  4. package/lib/element/assertion/contained.js +24 -1
  5. package/lib/element/assertion/defined.js +24 -1
  6. package/lib/element/assertion/property.js +24 -1
  7. package/lib/element/assertion/satisfies.js +24 -1
  8. package/lib/element/assertion/subproof.js +37 -1
  9. package/lib/element/assertion/type.js +27 -1
  10. package/lib/element/assumption.js +2 -7
  11. package/lib/element/combinator.js +16 -3
  12. package/lib/element/conclusion.js +18 -3
  13. package/lib/element/constructor.js +8 -2
  14. package/lib/element/declaration/complexType.js +52 -52
  15. package/lib/element/declaration/constructor.js +38 -38
  16. package/lib/element/declaration/metavariable.js +35 -35
  17. package/lib/element/declaration/simpleType.js +42 -42
  18. package/lib/element/declaration/typePrefix.js +32 -32
  19. package/lib/element/declaration/variable.js +39 -39
  20. package/lib/element/deduction.js +2 -4
  21. package/lib/element/equivalences.js +3 -3
  22. package/lib/element/frame.js +2 -9
  23. package/lib/element/hypothesis.js +18 -24
  24. package/lib/element/label.js +14 -3
  25. package/lib/element/metavariable.js +10 -3
  26. package/lib/element/parameter.js +2 -3
  27. package/lib/element/procedureCall.js +2 -3
  28. package/lib/element/procedureReference.js +2 -3
  29. package/lib/element/proofAssertion/premise.js +54 -49
  30. package/lib/element/proofAssertion/step.js +86 -86
  31. package/lib/element/proofAssertion/supposition.js +39 -49
  32. package/lib/element/property.js +2 -3
  33. package/lib/element/reference.js +2 -3
  34. package/lib/element/rule.js +2 -4
  35. package/lib/element/section.js +14 -14
  36. package/lib/element/signature.js +2 -3
  37. package/lib/element/statement.js +8 -2
  38. package/lib/element/subproof.js +8 -8
  39. package/lib/element/substitution/statement.js +2 -2
  40. package/lib/element/term.js +15 -29
  41. package/lib/element/topLevelAssertion/axiom.js +63 -63
  42. package/lib/element/topLevelMetaAssertion.js +15 -15
  43. package/lib/element/type.js +2 -3
  44. package/lib/element/typePrefix.js +2 -3
  45. package/lib/element/variable.js +2 -2
  46. package/lib/process/instantiate.js +38 -2
  47. package/lib/utilities/equivalence.js +27 -0
  48. package/lib/utilities/json.js +197 -30
  49. package/package.json +4 -4
  50. package/src/action/verify.js +0 -2
  51. package/src/context/ephemeral.js +84 -0
  52. package/src/context/file/nominal.js +30 -44
  53. package/src/element/assertion/contained.js +25 -0
  54. package/src/element/assertion/defined.js +25 -0
  55. package/src/element/assertion/property.js +25 -0
  56. package/src/element/assertion/satisfies.js +25 -0
  57. package/src/element/assertion/subproof.js +46 -0
  58. package/src/element/assertion/type.js +32 -0
  59. package/src/element/assumption.js +1 -12
  60. package/src/element/combinator.js +33 -3
  61. package/src/element/conclusion.js +33 -3
  62. package/src/element/constructor.js +17 -4
  63. package/src/element/declaration/complexType.js +49 -49
  64. package/src/element/declaration/constructor.js +32 -32
  65. package/src/element/declaration/metavariable.js +26 -26
  66. package/src/element/declaration/simpleType.js +34 -34
  67. package/src/element/declaration/typePrefix.js +35 -35
  68. package/src/element/declaration/variable.js +30 -30
  69. package/src/element/deduction.js +1 -6
  70. package/src/element/equivalences.js +1 -1
  71. package/src/element/frame.js +1 -15
  72. package/src/element/hypothesis.js +23 -34
  73. package/src/element/label.js +22 -5
  74. package/src/element/metavariable.js +20 -2
  75. package/src/element/parameter.js +1 -6
  76. package/src/element/procedureCall.js +1 -7
  77. package/src/element/procedureReference.js +1 -6
  78. package/src/element/proofAssertion/premise.js +54 -39
  79. package/src/element/proofAssertion/step.js +62 -62
  80. package/src/element/proofAssertion/supposition.js +27 -44
  81. package/src/element/property.js +1 -6
  82. package/src/element/reference.js +1 -6
  83. package/src/element/rule.js +3 -11
  84. package/src/element/section.js +12 -12
  85. package/src/element/signature.js +1 -7
  86. package/src/element/statement.js +13 -1
  87. package/src/element/subproof.js +6 -6
  88. package/src/element/substitution/statement.js +1 -1
  89. package/src/element/term.js +16 -24
  90. package/src/element/topLevelAssertion/axiom.js +45 -45
  91. package/src/element/topLevelMetaAssertion.js +19 -19
  92. package/src/element/type.js +1 -10
  93. package/src/element/typePrefix.js +1 -6
  94. package/src/element/variable.js +1 -1
  95. package/src/process/instantiate.js +26 -2
  96. package/src/utilities/equivalence.js +26 -0
  97. package/src/utilities/json.js +233 -37
@@ -1,8 +1,29 @@
1
1
  "use strict";
2
2
 
3
3
  import elements from "../elements";
4
+ import EphemeralContext from "../context/ephemeral";
4
5
 
5
- import { findMetaTypeByMetaTypeName } from "../metaTypes";
6
+ export function lemmasFromNothing() {
7
+ const lemmas = [];
8
+
9
+ return lemmas;
10
+ }
11
+
12
+ export function metaLemmasFromNothing() {
13
+ const metaLemmas = [];
14
+
15
+ return metaLemmas;
16
+ }
17
+
18
+ export function nameFromJSON(json, context) {
19
+ let { name } = json;
20
+
21
+ const nameJSON = name; ///
22
+
23
+ name = nameJSON; ///
24
+
25
+ return name;
26
+ }
6
27
 
7
28
  export function termFromJSON(json, context) {
8
29
  let { term } = json;
@@ -314,6 +335,22 @@ export function variablesFromJSON(json, context) {
314
335
  return variables;
315
336
  }
316
337
 
338
+ export function equalitiesFromJSON(json, context) {
339
+ let { equalities } = json;
340
+
341
+ const { Equality } = elements,
342
+ equalitiesJSON = equalities; ///
343
+
344
+ equalities = equalitiesJSON.map((equalityJSON) => {
345
+ const json = equalityJSON, ///
346
+ equality = Equality.fromJSON(json, context);
347
+
348
+ return equality;
349
+ });
350
+
351
+ return equalities;
352
+ }
353
+
317
354
  export function propertiesFromJSON(json, context) {
318
355
  let { properties } = json;
319
356
 
@@ -379,6 +416,75 @@ export function parametersFromJSON(json, context) {
379
416
  return parameters;
380
417
  }
381
418
 
419
+ export function judgementsFromJSON(json, context) {
420
+ let { judgements } = json;
421
+
422
+ const { Judgement } = elements,
423
+ judgementsJSON = judgements; ///
424
+
425
+ judgements = judgementsJSON.map((judgementJSON) => {
426
+ const json = judgementJSON, ///
427
+ judgement = Judgement.fromJSON(json, context);
428
+
429
+ return judgement;
430
+ });
431
+
432
+ return judgements;
433
+ }
434
+
435
+ export function statementsFromJSON(json, context) {
436
+ let { statements } = json;
437
+
438
+ const { Statement } = elements,
439
+ statementsJSON = statements; ///
440
+
441
+ statements = statementsJSON.map((statementJSON) => {
442
+ const json = statementJSON, ///
443
+ statement = Statement.fromJSON(json, context);
444
+
445
+ return statement;
446
+ });
447
+
448
+ return statements;
449
+ }
450
+
451
+ export function assertionsFromJSON(json, context) {
452
+ let { assertions } = json;
453
+
454
+ const { TypeAssertion, DefinedAssertion, PropertyAssertion, SubproofAssertion, SatisfiesAssertion, ContainedAssertion } = elements,
455
+ assertionsJSON = assertions; ///
456
+
457
+ assertions = assertionsJSON.map((assertionJSON) => {
458
+ const json = assertionJSON, ///
459
+ assertion = TypeAssertion.fromJSON(json, context) ||
460
+ DefinedAssertion.fromJSON(json, context) ||
461
+ PropertyAssertion.fromJSON(json, context) ||
462
+ SubproofAssertion.fromJSON(json, context) ||
463
+ SatisfiesAssertion.fromJSON(json, context) ||
464
+ ContainedAssertion.fromJSON(json, context);
465
+
466
+ return assertion;
467
+ });
468
+
469
+ return assertions;
470
+ }
471
+
472
+ export function referencesFromJSON(json, context) {
473
+ let { references } = json;
474
+
475
+ const { Reference } = elements,
476
+ referencesJSON = references; ///
477
+
478
+ references = referencesJSON.map((referenceJSON) => {
479
+ const json = referenceJSON, ///
480
+ reference = Reference.fromJSON(json, context);
481
+
482
+ return reference;
483
+ });
484
+
485
+ return references;
486
+ }
487
+
382
488
  export function conjecturesFromJSON(json, context) {
383
489
  let { conjectures } = json;
384
490
 
@@ -411,6 +517,22 @@ export function combinatorsFromJSON(json, context) {
411
517
  return combinators;
412
518
  }
413
519
 
520
+ export function assumptionsFromJSON(json, context) {
521
+ let { assumptions } = json;
522
+
523
+ const { Assumption } = elements,
524
+ assumptionsJSON = assumptions; ///
525
+
526
+ assumptions = assumptionsJSON.map((assumptionJSON) => {
527
+ const json = assumptionJSON, ///
528
+ assumption = Assumption.fromJSON(json, context);
529
+
530
+ return assumption;
531
+ });
532
+
533
+ return assumptions;
534
+ }
535
+
414
536
  export function typePrefixesFromJSON(json, context) {
415
537
  let { typePrefixes } = json;
416
538
 
@@ -508,16 +630,24 @@ export function metavariablesFromJSON(json, context) {
508
630
  return metavariables;
509
631
  }
510
632
 
511
- export function lemmasFromNothing() {
512
- const lemmas = [];
633
+ export function ephemeralContextFromJSON(json, context) {
634
+ const releaseContext = context;
513
635
 
514
- return lemmas;
636
+ ({context} = json);
637
+
638
+ json = context; ///
639
+
640
+ context = releaseContext; ///
641
+
642
+ const emphemeralContext = EphemeralContext.fromJSON(json, context);
643
+
644
+ return emphemeralContext;
515
645
  }
516
646
 
517
- export function metaLemmasFromNothing() {
518
- const metaLemmas = [];
647
+ export function nameToNameJSON(name) {
648
+ const nameJSON = name; ///
519
649
 
520
- return metaLemmas;
650
+ return nameJSON;
521
651
  }
522
652
 
523
653
  export function termToTermJSON(term) {
@@ -602,6 +732,16 @@ export function procedureReferenceToProcedureReferenceJSON(procedureReference) {
602
732
  return procedureReferenceJSON;
603
733
  }
604
734
 
735
+ export function termsToTermsJSON(terms) {
736
+ const termsJSON = terms.map((term) => {
737
+ const termJSON = term.toJSON();
738
+
739
+ return termJSON;
740
+ });
741
+
742
+ return termsJSON;
743
+ }
744
+
605
745
  export function typesToTypesJSON(types) {
606
746
  const typesJSON = types.map((type) => {
607
747
  const typeJSON = type.toJSON();
@@ -614,18 +754,6 @@ export function typesToTypesJSON(types) {
614
754
  return typesJSON;
615
755
  }
616
756
 
617
- export function termsToTermsJSON(terms) {
618
- const termsJSON = terms.map((term) => {
619
- const termJSON = term.toJSON();
620
-
621
- term = termJSON; ///
622
-
623
- return term;
624
- });
625
-
626
- return termsJSON;
627
- }
628
-
629
757
  export function rulesToRulesJSON(rules) {
630
758
  const rulesJSON = rules.map((rule) => {
631
759
  const ruleJSON = rule.toJSON();
@@ -638,18 +766,6 @@ export function rulesToRulesJSON(rules) {
638
766
  return rulesJSON;
639
767
  }
640
768
 
641
- export function framesToFramesJSON(frames) {
642
- const framesJSON = frames.map((frame) => {
643
- const frameJSON = frame.toJSON();
644
-
645
- frame = frameJSON; ///
646
-
647
- return frame;
648
- });
649
-
650
- return framesJSON;
651
- }
652
-
653
769
  export function labelsToLabelsJSON(labels) {
654
770
  const labelsJSON = labels.map((label) => {
655
771
  const labelJSON = label.toJSON();
@@ -660,6 +776,16 @@ export function labelsToLabelsJSON(labels) {
660
776
  return labelsJSON;
661
777
  }
662
778
 
779
+ export function framesToFramesJSON(frames) {
780
+ const framesJSON = frames.map((frame) => {
781
+ const frameJSON = frame.toJSON();
782
+
783
+ return frameJSON;
784
+ });
785
+
786
+ return framesJSON;
787
+ }
788
+
663
789
  export function axiomsToAxiomsJSON(axioms) {
664
790
  const axiomsJSON = axioms.map((axiom) => {
665
791
  const axiomJSON = axiom.toJSON();
@@ -754,16 +880,54 @@ export function propertiesToPropertiesJSON(properties) {
754
880
  return propertiesJSON;
755
881
  }
756
882
 
757
- export function typePrefixesToTypePrefixesJSON(typePrefixes) {
758
- const typePrefixesJSON = typePrefixes.map((typePrefix) => {
759
- const typePrefixJSON = typePrefix.toJSON();
883
+ export function judgementsToJudgementsJSON(judgements) {
884
+ const judgementsJSON = judgements.map((judgement) => {
885
+ const judgementJSON = judgement.toJSON();
760
886
 
761
- typePrefix = typePrefixJSON; ///
887
+ return judgementJSON;
888
+ });
762
889
 
763
- return typePrefix;
890
+ return judgementsJSON;
891
+ }
892
+
893
+ export function equalitiesToEqualitiesJSON(equalities) {
894
+ const equalitiesJSON = equalities.map((equality) => {
895
+ const equalityJSON = equality.toJSON();
896
+
897
+ return equalityJSON;
764
898
  });
765
899
 
766
- return typePrefixesJSON;
900
+ return equalitiesJSON;
901
+ }
902
+
903
+ export function statementsToStatementsJSON(statements) {
904
+ const statementsJSON = statements.map((statement) => {
905
+ const statementJSON = statement.toJSON();
906
+
907
+ return statementJSON;
908
+ });
909
+
910
+ return statementsJSON;
911
+ }
912
+
913
+ export function assertionsToAssertionsJSON(assertions) {
914
+ const assertionsJSON = assertions.map((assertion) => {
915
+ const assertionJSON = assertion.toJSON();
916
+
917
+ return assertionJSON;
918
+ });
919
+
920
+ return assertionsJSON;
921
+ }
922
+
923
+ export function referencesToReferencesJSON(references) {
924
+ const referencesJSON = references.map((reference) => {
925
+ const referenceJSON = reference.toJSON();
926
+
927
+ return referenceJSON;
928
+ });
929
+
930
+ return referencesJSON;
767
931
  }
768
932
 
769
933
  export function conjecturesToConjecturesJSON(conjectures) {
@@ -790,6 +954,16 @@ export function combinatorsToCombinatorsJSON(combinators) {
790
954
  return combinatorsJSON;
791
955
  }
792
956
 
957
+ export function assumptionsToAssumptionsJSON(assumptions) {
958
+ const assumptionsJSON = assumptions.map((assumption) => {
959
+ const assumptionJSON = assumption.toJSON();
960
+
961
+ return assumptionJSON;
962
+ });
963
+
964
+ return assumptionsJSON;
965
+ }
966
+
793
967
  export function suppositionsToSuppositionsJSON(suppositions) {
794
968
  const suppositionsJSON = suppositions.map((supposition) => {
795
969
  const suppositionJSON = supposition.toJSON();
@@ -824,6 +998,18 @@ export function metatheoremsToMetatheoremsJSON(metatheorems) {
824
998
  return metatheoremsJSON;
825
999
  }
826
1000
 
1001
+ export function typePrefixesToTypePrefixesJSON(typePrefixes) {
1002
+ const typePrefixesJSON = typePrefixes.map((typePrefix) => {
1003
+ const typePrefixJSON = typePrefix.toJSON();
1004
+
1005
+ typePrefix = typePrefixJSON; ///
1006
+
1007
+ return typePrefix;
1008
+ });
1009
+
1010
+ return typePrefixesJSON;
1011
+ }
1012
+
827
1013
  export function substitutionsToSubstitutionsJSON(substitutions) {
828
1014
  const substitutionsJSON = substitutions.mapSubstitution((substitution) => {
829
1015
  const substitutionJSON = substitution.toJSON();
@@ -845,3 +1031,13 @@ export function metavariablesToMetavariablesJSON(metavariables) {
845
1031
 
846
1032
  return metavariablesJSON;
847
1033
  }
1034
+
1035
+ export function substitutionsToCSubstitutionsJSON(substitutiions) {
1036
+ const substitutionsJSON = substitutiions.map((substitution) => {
1037
+ const substitutionJSON = substitution.toJSON();
1038
+
1039
+ return substitutionJSON;
1040
+ });
1041
+
1042
+ return substitutionsJSON;
1043
+ }