package archetype
Archetype language compiler
Install
Dune Dependency
Authors
Maintainers
Sources
1.1.2.tar.gz
md5=cc3e66ac130df626f0210be8ce68b1b0
sha512=913e561827e5559b8f7f68dc286e257ee484ccacb2fba8e7a4996576107969f7c4bb42f8a759ea082c1a6f0c2874297d52369f0840041177f23c85a2c99053e6
doc/src/archetype/mlwtree.ml.html
Source file mlwtree.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988
open Tools type exn = | Enotfound | Ekeyexist | Enegassignnat | Einvalidcaller | Einvalidcondition | Einvalidstate | Enotransfer | Ebreak | Einvalid of string option [@@deriving show {with_path = false}] type fmod = | Logic | Rec | NoMod [@@deriving show {with_path = false}] (* abstract types -------------------------------------------------------------*) type 'i abstract_qualid = 'i list [@@deriving show {with_path = false}] type ('i,'t) abstract_type = | Tyint | Tyuint | Tybool | Tystring | Tyrational | Tyaddr | Tyrole | Tykey | Tykeyhash | Tydate | Tyduration | Tytez | Tysignature | Tybytes | Tychainid | Tystorage | Tyoperation | Tyentrysig | Tyunit | Tycontract of 'i | Tyrecord of 'i | Tycoll of 'i | Tyview of 'i | Tymap of 'i | Tyasset of 'i | Typartition of 'i | Tyaggregate of 'i | Tystate | Tyenum of 'i | Tyoption of 't | Tyset of 'i | Tylist of 't | Tytuple of 't list (* ... *) [@@deriving show {with_path = false}] type ('t,'i) abstract_univ_decl = 'i list * 't [@@deriving show {with_path = false}] type 'i pattern_node = | Twild | Tpignore | Tconst of 'i | Tpatt_tuple of 'i pattern_node list | Tpsome of 'i [@@deriving show {with_path = false}] type ('e,'t,'i) abstract_term = | Tseq of 'e list | Tletin of bool * 'i * 't option * 'e * 'e | Tletfun of ('e,'t,'i) abstract_fun_struct * 'e | Tif of 'e * 'e * 'e option | Tmatch of 'e * ('i pattern_node * 'e) list | Tapp of 'e * 'e list | Tfor of 'i * 'e * 'e * ('e,'i) abstract_formula list * 'e (* id, from, to, invariants *) | Ttry of 'e * (exn * 'e) list | Tvar of 'i | Ttuple of 'e list | Ttupleaccess of 'e * int * int (* record *) | Trecord of 'e option * ('i * 'e) list (* { 'e with 'i = 'e; } *) | Tdot of 'e * 'e | Tdoti of 'i * 'i (* storage fields *) | Tename | Tcaller of 'i | Tsender of 'i | Ttransferred of 'i | Tnow of 'i | Tadded of 'i | Trmed of 'i | Tchainid of 'i | Tselfaddress of 'i | Tdefaultaddr | Temptystr (* list *) | Tlist of 'e list | Tnil of 'i | Temptycoll of 'i | Temptyview of 'i | Temptyfield of 'i | Tcard of 'i * 'e | Tfromfield of 'i * 'e * 'e | Tfromview of 'i * 'e * 'e | Ttoview of 'i * 'e | Tviewtolist of 'i * 'e *'e | Telts of 'i * 'e | Tshallow of 'i * 'e * 'e | Tmlist of 'i * 'e * 'i * 'i * 'i * 'e (* match list *) | Tcons of 'i * 'e * 'e | Tprepend of 'i * 'e * 'e | Tmkcoll of 'i * 'e list | Tmkview of 'i * 'e | Tcontent of 'i * 'e | Tcontains of 'i * 'e * 'e | Tvcontent of 'i * 'e (* archetype lib *) | Tadd of 'i * 'e * 'e | Tvadd of 'i * 'e * 'e | Tremove of 'i * 'e * 'e | Tvremove of 'i * 'e * 'e | Tget of 'i * 'e * 'e | Tgetforce of 'i * 'e * 'e | Tfget of 'i * 'e * 'e (* logical pure get; no fail *) | Tset of 'i * 'e * 'e * 'e | Tvsum of 'i * 'e * 'e | Tcsum of 'i * 'e | Tcsort of 'i * 'e | Tvsort of 'i * 'e * 'e | Tnth of 'i * 'e * 'e | Tnthtuple of int * int * 'e | Tcoll of 'i * 'e | Tassign of 'e * 'e | Traise of exn | Texn of exn | Tconcat of 'e * 'e | Ttransfer of 'e * 'e | Tcall of 'e * 'e * 'i * 'e | Tmkoperation of 'e * 'e * 'e | Tentrypoint of 'i * 'e | Tfst of 'e | Tsnd of 'e | Tsndopt of 'e | Tabs of 'e (* trace *) | Tmktr of 'e * 'e | Ttradd of 'i | Ttrrm of 'i (* operators *) | Tplus of 't * 'e * 'e | Tminus of 't * 'e * 'e | Tuminus of 't * 'e | Tmult of 't * 'e * 'e | Tdiv of 't * 'e * 'e | Tmod of 't * 'e * 'e | Tnot of 'e | Tpand of 'e * 'e (* comp *) | Teq of 't * 'e * 'e | Teqfield of 'i * 'e * 'e | Tneq of 't * 'e * 'e | Tlt of 't * 'e * 'e | Tle of 't * 'e * 'e | Tgt of 't * 'e * 'e | Tge of 't * 'e * 'e (* double comp *) | Tdlt of 't * 'e * 'e * 'e (* _ < _ < _ *) | Tdle of 't * 'e * 'e * 'e (* _ <= _ <= _ *) | Tdlet of 't * 'e * 'e * 'e (* _ < _ <= _ *) | Tdlte of 't * 'e * 'e * 'e (* _ < _ <= _ *) (* literals *) | Tint of Core.big_int | Tstring of string | Taddr of string | Tbytes of string (* spec *) | Tforall of (('t,'i) abstract_univ_decl list) * 'e | Texists of (('t,'i) abstract_univ_decl list) * 'e | Tresult | Timpl of 'e * 'e | Tequiv of 'e * 'e | Tand of 'e * 'e | Tor of 'e * 'e | Told of 'e | Tfalse | Ttrue | Tunion of 'i * 'e * 'e | Tinter of 'i * 'e * 'e | Tdiff of 'i * 'e * 'e | Tsubset of 'i * 'e * 'e | Tassert of 'i option * 'e (* set *) | Tmem of 'i * 'e * 'e | Tvmem of 'i * 'e * 'e | Tlmem of 'i * 'e * 'e | Tccontains of 'i * 'e * 'e | Tvcontains of 'i * 'e * 'e | Tempty of 'i * 'e | Tvempty of 'i * 'e | Tsingl of 'i * 'e | Tchead of 'i * 'e * 'e | Tvhead of 'i * 'e * 'e | Tctail of 'i * 'e * 'e | Tvtail of 'i * 'e * 'e | Tcnth of 'i * 'e * 'e | Tvnth of 'i * 'e * 'e | Tlnth of 'i * 'e * 'e | Tselect of 'i * 'i * 'e list * 'e | Tcselect of 'i * 'i * 'e list * 'e | Tvselect of 'i * 'i * 'e list * 'e * 'e | Tremoveif of 'i * 'i * 'e list * 'e | Tpremoveif of 'i * 'i * 'e list * 'e * 'e | Tfremoveif of 'i * 'i * 'e list * 'e * 'e * 'e | Tunionpred of 'i * 'i * 'e list * 'e | Twitness of 'i (* option *) | Tnone | Tsome of 'e | Tenum of 'i | Tmark of 'i * 'e | Tat of 'i * 'e | Tunit (* escape node *) | Ttobereplaced | Tnottranslated (* ... *) [@@deriving show {with_path = false}] and ('e,'i) abstract_formula = { id : 'i; form : 'e; } [@@deriving show {with_path = false}] and ('e,'t,'i) abstract_fun_struct = { name : 'i; logic : fmod; args : ('i * 't) list; returns : 't; raises : 'e list; variants : 'e list; requires : (('e,'i) abstract_formula) list; ensures : (('e,'i) abstract_formula) list; body : 'e; } [@@deriving show {with_path = false}] type ('e,'t,'i) abstract_field = { name : 'i; typ : 't; init : 'e; mutable_ : bool; } [@@deriving show {with_path = false}] type ('e,'t,'i) abstract_storage_struct = { fields : ('e,'t,'i) abstract_field list; invariants : ('e,'i) abstract_formula list; } [@@deriving show {with_path = false}] type ('i,'t) abstract_clone_subst = | Ctype of 'i * 't | Cval of 'i * 'i | Cfun of 'i * 'i | Cpred of 'i * 'i [@@deriving show {with_path = false}] type theotyp = | Theo | Axiom | Lemma | Goal [@@deriving show {with_path = false}] type ('e,'t,'i) abstract_decl = | Duse of bool * 'i abstract_qualid * string option | Dval of bool * 'i * 't | Dclone of 'i abstract_qualid * 'i * (('i,'t) abstract_clone_subst) list | Denum of 'i * 'i list | Drecord of 'i * (('e,'t,'i) abstract_field) list | Dstorage of ('e,'t,'i) abstract_storage_struct | Dtheorem of theotyp * 'i * 'e | Dfun of ('e,'t,'i) abstract_fun_struct [@@deriving show {with_path = false}] type ('e,'t,'i) abstract_module = { name : 'i; decls : ('e,'t,'i) abstract_decl list; } [@@deriving show {with_path = false}] (* 'e : expression type 't : type type 'i : ident type *) type ('e,'t,'i) abstract_mlw_tree = ('e,'t,'i) abstract_module list [@@deriving show {with_path = false}] (* abstract mappers ------------------------------------------------------------*) let map_abstract_qualid (map_i : 'i1 -> 'i2) (q1 : 'i1 abstract_qualid) = List.map map_i q1 let map_abstract_type (map_i : 'i1 -> 'i2) (map_t : 't1 -> 't2) = function | Tyint -> Tyint | Tystring -> Tystring | Tyaddr -> Tyaddr | Tyrole -> Tyrole | Tydate -> Tydate | Tytez -> Tytez | Tybytes -> Tybytes | Tychainid -> Tychainid | Tystorage -> Tystorage | Tyunit -> Tyunit | Tyoperation -> Tyoperation | Tyentrysig -> Tyentrysig | Tyrecord i -> Tyrecord (map_i i) | Tycoll i -> Tycoll (map_i i) | Tyview i -> Tyview (map_i i) | Tymap i -> Tymap (map_i i) | Tyasset i -> Tyasset (map_i i) | Typartition i -> Typartition (map_i i) | Tyaggregate i -> Tyaggregate (map_i i) | Tyenum i -> Tyenum (map_i i) | Tyoption t -> Tyoption (map_t t) | Tyset i -> Tyset (map_i i) | Tylist t -> Tylist (map_t t) | Tycontract i -> Tycontract (map_i i) | Tybool -> Tybool | Tyuint -> Tyuint | Tyrational -> Tyrational | Tyduration -> Tyduration | Tysignature -> Tysignature | Tykey -> Tykey | Tykeyhash -> Tykeyhash | Tystate -> Tystate | Tytuple l -> Tytuple (List.map map_t l) let map_abstract_univ_decl (map_t : 't1 -> 't2) (map_i : 'i1 -> 'i2) (ids,t : ('t1,'i1) abstract_univ_decl) : ('t2,'i2) abstract_univ_decl = (List.map map_i ids, map_t t) let rec map_pattern map = function | Twild -> Twild | Tpignore -> Tpignore | Tconst i -> Tconst (map i) | Tpatt_tuple l -> Tpatt_tuple (List.map (map_pattern map) l) | Tpsome i -> Tpsome (map i) let rec map_abstract_formula (map_e : 'e1 -> 'e2) (map_i : 'i1 -> 'i2) (f : ('e1,'i1) abstract_formula) = { id = map_i f.id; form = map_e f.form; } and map_abstract_fun_struct (map_e : 'e1 -> 'e2) (map_t : 't1 -> 't2) (map_i : 'i1 -> 'i2) (f : ('e1,'t1,'i1) abstract_fun_struct) = { name = map_i f.name; logic = f.logic; args = List.map (fun (a,t) -> (map_i a, map_t t)) f.args; returns = map_t f.returns; raises = List.map map_e f.raises; variants = List.map map_e f.variants; requires = List.map (map_abstract_formula map_e map_i) f.requires; ensures = List.map (map_abstract_formula map_e map_i) f.ensures; body = map_e f.body; } and map_abstract_term (map_e : 'e1 -> 'e2) (map_t : 't1 -> 't2) (map_i : 'i1 -> 'i2) = function | Tseq l -> Tseq (List.map map_e l) | Tletin (r,i,t,b,e) -> Tletin (r,map_i i, Option.map map_t t, map_e b, map_e e) | Tletfun (s,e) -> Tletfun (map_abstract_fun_struct map_e map_t map_i s, map_e e) | Tif (i,t,e) -> Tif (map_e i, map_e t, Option.map map_e e) | Tmatch (t,l) -> Tmatch (map_e t, List.map (fun (p,t) -> (map_pattern map_i p,map_e t)) l) | Tapp (f,a) -> Tapp (map_e f, List.map map_e a) | Tfor (i,f,s,l,b) -> Tfor (map_i i, map_e f, map_e s, List.map (map_abstract_formula map_e map_i) l, map_e b) | Ttry (b,l) -> Ttry (map_e b, List.map (fun (exn,e) -> (exn,map_e e)) l) | Tassert (l,e) -> Tassert (Option.map map_i l,map_e e) | Tvar i -> Tvar (map_i i) | Ttuple l -> Ttuple (List.map map_e l) | Ttupleaccess (e1,e2,e3) -> Ttupleaccess (map_e e1, e2, e3) | Trecord (e,l) -> Trecord (Option.map map_e e, List.map (fun (i,v) -> (map_i i,map_e v)) l) | Tdot (e1,e2) -> Tdot (map_e e1, map_e e2) | Tdoti (i1,i2) -> Tdoti (map_i i1, map_i i2) | Tename -> Tename | Tcaller i -> Tcaller (map_i i) | Tentrypoint (i,e) -> Tentrypoint (map_i i, map_e e) | Tsender i -> Tsender (map_i i) | Ttransferred i -> Ttransferred (map_i i) | Tfst e -> Tfst (map_e e) | Tsnd e -> Tsnd (map_e e) | Tsndopt e -> Tsndopt (map_e e) | Tabs e -> Tabs (map_e e) | Tnow i -> Tnow (map_i i) | Tchainid i -> Tchainid (map_i i) | Tselfaddress i -> Tselfaddress (map_i i) | Tdefaultaddr -> Tdefaultaddr | Temptystr -> Temptystr | Tadded a -> Tadded (map_i a) | Trmed a -> Trmed (map_i a) | Tlist l -> Tlist (List.map map_e l) | Tnil i -> Tnil (map_i i) | Temptycoll i -> Temptycoll (map_i i) | Temptyview i -> Temptyview (map_i i) | Temptyfield i -> Temptyfield (map_i i) | Tcard (i,e) -> Tcard (map_i i, map_e e) | Tmkcoll (i,e) -> Tmkcoll (map_i i, List.map map_e e) | Tmkview (i,e) -> Tmkview (map_i i, map_e e) | Tcontent (i,e) -> Tcontent (map_i i, map_e e) | Tcontains (i,e1,e2)-> Tcontains (map_i i, map_e e1, map_e e2) | Tvcontent (i,e) -> Tvcontent (map_i i, map_e e) | Tfromfield (i,e1,e2) -> Tfromfield (map_i i, map_e e1, map_e e2) | Tfromview (i,e1,e2) -> Tfromview (map_i i, map_e e1, map_e e2) | Ttoview (i,e) -> Ttoview (map_i i, map_e e) | Tviewtolist (i,e1,e2) -> Tviewtolist (map_i i, map_e e1, map_e e2) | Telts (i,e) -> Telts (map_i i, map_e e) | Tshallow (i,e1,e2) -> Tshallow (map_i i, map_e e1, map_e e2) | Tmlist (l,e1,i1,i2,i3,e2) -> Tmlist (map_i l,map_e e1, map_i i1, map_i i2, map_i i3, map_e e2) | Tcons (i,e1,e2) -> Tcons (map_i i, map_e e1, map_e e2) | Tprepend (i,e1,e2) -> Tprepend (map_i i, map_e e1, map_e e2) | Tadd (i1,e1,e2) -> Tadd (map_i i1, map_e e1, map_e e2) | Tvadd (i1,e1,e2) -> Tvadd (map_i i1, map_e e1, map_e e2) | Tremove (i,e1,e2) -> Tremove (map_i i,map_e e1, map_e e2) | Tvremove (i,e1,e2) -> Tvremove (map_i i,map_e e1, map_e e2) | Tget (i,e1,e2) -> Tget (map_i i, map_e e1, map_e e2) | Tgetforce (i,e1,e2) -> Tgetforce (map_i i, map_e e1, map_e e2) | Tfget (i,e1,e2) -> Tfget (map_i i, map_e e1, map_e e2) | Tset (i, e1,e2,e3) -> Tset (map_i i, map_e e1, map_e e2, map_e e3) | Tvsum (i,e1,e2) -> Tvsum (map_i i, map_e e1, map_e e2) | Tcsum (i,e1) -> Tcsum (map_i i, map_e e1) | Tcsort (i,e1) -> Tcsort (map_i i, map_e e1) | Tvsort (i,e1,e2) -> Tvsort (map_i i, map_e e1, map_e e2) | Tnth (i,e1,e2) -> Tnth (map_i i, map_e e1, map_e e2) | Tnthtuple (i1,i2,e)-> Tnthtuple (i1, i2, map_e e) | Tcoll (i, e) -> Tcoll (map_i i, map_e e) | Tassign (e1,e2) -> Tassign (map_e e1, map_e e2) | Traise e -> Traise e | Texn e -> Texn e | Tconcat (e1,e2) -> Tconcat (map_e e1, map_e e2) | Ttransfer (e1,e2) -> Ttransfer (map_e e1, map_e e2) | Tcall (a,c,n,l) -> Tcall (map_e a,map_e c,map_i n,map_e l) | Tmkoperation (a,c,l) -> Tmkoperation (map_e a,map_e c,map_e l) | Tmktr (e1,e2) -> Tmktr (map_e e1, map_e e2) | Ttradd i -> Ttradd (map_i i) | Ttrrm i -> Ttrrm (map_i i) | Tplus (t,l,r) -> Tplus (map_t t, map_e l, map_e r) | Tminus (t,l,r) -> Tminus (map_t t, map_e l, map_e r) | Tuminus (t,e) -> Tuminus (map_t t, map_e e) | Tmult (t,l,r) -> Tmult (map_t t, map_e l, map_e r) | Tdiv (t,l,r) -> Tdiv (map_t t, map_e l, map_e r) | Tmod (t,l,r) -> Tmod (map_t t, map_e l, map_e r) | Tnot e -> Tnot (map_e e) | Tpand (e1,e2) -> Tpand (map_e e1,map_e e2) | Teq (t,l,r) -> Teq (map_t t, map_e l, map_e r) | Teqfield (i,l,r) -> Teqfield (map_i i, map_e l, map_e r) | Tneq (t,l,r) -> Tneq (map_t t, map_e l, map_e r) | Tlt (t,l,r) -> Tlt (map_t t, map_e l, map_e r) | Tle (t,l,r) -> Tle (map_t t, map_e l, map_e r) | Tgt (t,l,r) -> Tgt (map_t t, map_e l, map_e r) | Tge (t,l,r) -> Tge (map_t t, map_e l, map_e r) | Tdlt (t,e1,e2,e3) -> Tdlt (map_t t,map_e e1,map_e e2,map_e e3) | Tdle (t,e1,e2,e3) -> Tdle (map_t t,map_e e1,map_e e2,map_e e3) | Tdlet (t,e1,e2,e3) -> Tdlet (map_t t,map_e e1,map_e e2,map_e e3) | Tdlte (t,e1,e2,e3) -> Tdlte (map_t t,map_e e1,map_e e2,map_e e3) | Tint i -> Tint i | Tstring s -> Tstring s | Taddr s -> Taddr s | Tbytes s -> Tbytes s | Tforall (l,e) -> Tforall (List.map (map_abstract_univ_decl map_t map_i) l, map_e e) | Texists (l,e) -> Texists (List.map (map_abstract_univ_decl map_t map_i) l, map_e e) | Timpl (e1,e2) -> Timpl (map_e e1, map_e e2) | Tequiv (e1,e2) -> Tequiv (map_e e1, map_e e2) | Tor (e1,e2) -> Tor (map_e e1, map_e e2) | Tand (e1,e2) -> Tand (map_e e1, map_e e2) | Told e -> Told (map_e e) | Tunion (i,e1,e2) -> Tunion (map_i i, map_e e1, map_e e2) | Tinter (i,e1,e2) -> Tinter (map_i i, map_e e1, map_e e2) | Tdiff (i,e1,e2) -> Tdiff (map_i i, map_e e1, map_e e2) | Tsubset (i,e1,e2) -> Tsubset (map_i i, map_e e1, map_e e2) | Tresult -> Tresult | Tmem (t,e1,e2) -> Tmem (map_i t, map_e e1, map_e e2) | Tvmem (t,e1,e2) -> Tvmem (map_i t, map_e e1, map_e e2) | Tlmem (t,e1,e2) -> Tlmem (map_i t, map_e e1, map_e e2) | Tccontains (t,e1,e2) -> Tccontains (map_i t, map_e e1, map_e e2) | Tvcontains (t,e1,e2) -> Tvcontains (map_i t, map_e e1, map_e e2) | Tempty (i,e) -> Tempty (map_i i, map_e e) | Tvempty (i,e) -> Tvempty (map_i i, map_e e) | Tsingl (i,e) -> Tsingl (map_i i, map_e e) | Tvhead (i,e1,e2) -> Tvhead (map_i i,map_e e1, map_e e2) | Tchead (i,e1,e2) -> Tchead (map_i i,map_e e1, map_e e2) | Tctail (i,e1,e2) -> Tctail (map_i i,map_e e1, map_e e2) | Tvtail (i,e1,e2) -> Tvtail (map_i i,map_e e1, map_e e2) | Tcnth (i,e1,e2) -> Tcnth (map_i i, map_e e1, map_e e2) | Tvnth (i,e1,e2) -> Tvnth (map_i i, map_e e1, map_e e2) | Tlnth (i,e1,e2) -> Tlnth (map_i i, map_e e1, map_e e2) | Tselect (i1,i2,l,e)-> Tselect (map_i i1, map_i i2, List.map map_e l, map_e e) | Tcselect (i1,i2,l,e)-> Tcselect (map_i i1, map_i i2, List.map map_e l, map_e e) | Tvselect (i1,i2,l,e1,e2)-> Tvselect (map_i i1, map_i i2, List.map map_e l, map_e e1, map_e e2) | Tremoveif (i1,i2,l,e)-> Tremoveif (map_i i1, map_i i2, List.map map_e l, map_e e) | Tpremoveif (i1,i2,l,e1,e2)-> Tpremoveif (map_i i1, map_i i2, List.map map_e l, map_e e1, map_e e2) | Tfremoveif (i1,i2,l,e1,e2,e3)-> Tfremoveif (map_i i1, map_i i2, List.map map_e l, map_e e1, map_e e2, map_e e3) | Tunionpred (i1,i2,l,e)-> Tunionpred (map_i i1, map_i i2, List.map map_e l, map_e e) | Twitness i -> Twitness (map_i i) | Tnone -> Tnone | Tsome e -> Tsome (map_e e) | Tenum i -> Tenum (map_i i) | Tmark (i,e) -> Tmark (map_i i, map_e e) | Tat (i,e) -> Tat (map_i i, map_e e) | Tunit -> Tunit | Ttobereplaced -> Ttobereplaced | Tnottranslated -> Tnottranslated | Ttrue -> Ttrue | Tfalse -> Tfalse let map_abstract_field (map_e : 'e1 -> 'e2) (map_t : 't1 -> 't2) (map_i : 'i1 -> 'i2) (f : ('e1,'t1,'i1) abstract_field) = { name = map_i f.name; typ = map_t f.typ; init = map_e f.init; mutable_ = f.mutable_; } let map_abstract_storage_struct (map_e : 'e1 -> 'e2) (map_t : 't1 -> 't2) (map_i : 'i1 -> 'i2) (s : ('e1,'t1,'i1) abstract_storage_struct) = { fields = List.map (map_abstract_field map_e map_t map_i) s.fields; invariants = List.map (map_abstract_formula map_e map_i) s.invariants; } let map_abstract_clone_subst (map_i : 'i1 -> 'i2) (map_t : 't1 -> 't2) = function | Ctype (i1,i2) -> Ctype (map_i i1, map_t i2) | Cval (i1,i2) -> Cval (map_i i1, map_i i2) | Cfun (i1,i2) -> Cfun (map_i i1, map_i i2) | Cpred (i1,i2) -> Cpred (map_i i1, map_i i2) let map_abstract_decl (map_e : 'e1 -> 'e2) (map_t : 't1 -> 't2) (map_i : 'i1 -> 'i2) = function | Duse (b,i,l) -> Duse (b,map_abstract_qualid map_i i,l) | Dval (r,i,t) -> Dval (r,map_i i, map_t t) | Dclone (q,i,l) -> Dclone (map_abstract_qualid map_i q, map_i i, List.map (map_abstract_clone_subst map_i map_t) l) | Denum (i,l) -> Denum (map_i i, List.map map_i l) | Drecord (i,l) -> Drecord (map_i i, List.map (map_abstract_field map_e map_t map_i) l) | Dstorage s -> Dstorage (map_abstract_storage_struct map_e map_t map_i s) | Dtheorem (t,i,e) -> Dtheorem (t,map_i i, map_e e) | Dfun f -> Dfun (map_abstract_fun_struct map_e map_t map_i f) let map_abstract_module (map_e : 'e1 -> 'e2) (map_t : 't1 -> 't2) (map_i : 'i1 -> 'i2) (t : ('e1,'t1,'i1) abstract_module) = { name = map_i t.name; decls = List.map (map_abstract_decl map_e map_t map_i) t.decls; } let map_abstract_mlw_tree (map_e : 'e1 -> 'e2) (map_t : 't1 -> 't2) (map_i : 'i1 -> 'i2) (t : ('e1,'t1,'i1) abstract_mlw_tree) = List.map (map_abstract_module map_e map_t map_i) t (* no location types -----------------------------------------------------------*) type ident = string [@@deriving show {with_path = false}] type qualid = ident abstract_qualid [@@deriving show {with_path = false}] type typ = (ident, typ) abstract_type [@@deriving show {with_path = false}] type univ_decl = (typ,ident) abstract_univ_decl [@@deriving show {with_path = false}] type term = (term,typ,ident) abstract_term [@@deriving show {with_path = false}] type formula = (term,ident) abstract_formula [@@deriving show {with_path = false}] type field = (term,typ,ident) abstract_field [@@deriving show {with_path = false}] type fun_struct = (term,typ,ident) abstract_fun_struct [@@deriving show {with_path = false}] type storage_struct = (term,typ,ident) abstract_storage_struct [@@deriving show {with_path = false}] type clone_subst = (ident,typ) abstract_clone_subst [@@deriving show {with_path = false}] type decl = (term,typ,ident) abstract_decl [@@deriving show {with_path = false}] type mlw_module = (term,typ,ident) abstract_module [@@deriving show {with_path = false}] type mlw_tree = (term,typ,ident) abstract_mlw_tree [@@deriving show {with_path = false}] (* with location types --------------------------------------------------------*) type 'o with_loc = { obj : 'o; (* object *) loc : Location.t [@opaque]; (* location of object *) } [@@deriving show {with_path = false}] type loc_ident = string with_loc [@@deriving show {with_path = false}] type loc_qualid = (loc_ident abstract_qualid) with_loc [@@deriving show {with_path = false}] type loc_typ = ((loc_ident, loc_typ) abstract_type) with_loc [@@deriving show {with_path = false}] type loc_univ_decl = ((loc_typ,loc_ident) abstract_univ_decl) with_loc [@@deriving show {with_path = false}] type loc_term = ((loc_term,loc_typ,loc_ident) abstract_term) with_loc [@@deriving show {with_path = false}] type loc_formula = ((loc_term,loc_ident) abstract_formula) with_loc [@@deriving show {with_path = false}] type loc_field = ((loc_term,loc_typ,loc_ident) abstract_field) with_loc [@@deriving show {with_path = false}] type loc_fun_struct = ((loc_term,loc_typ,loc_ident) abstract_fun_struct) with_loc [@@deriving show {with_path = false}] type loc_storage_struct= ((loc_term,loc_typ,loc_ident) abstract_storage_struct) with_loc [@@deriving show {with_path = false}] type loc_clone_subst = ((loc_ident,loc_typ) abstract_clone_subst) with_loc [@@deriving show {with_path = false}] type loc_decl = ((loc_term,loc_typ,loc_ident) abstract_decl) with_loc [@@deriving show {with_path = false}] type loc_mlw_module = (loc_term,loc_typ,loc_ident) abstract_module [@@deriving show {with_path = false}] type loc_mlw_tree = (loc_term,loc_typ,loc_ident) abstract_mlw_tree [@@deriving show {with_path = false}] (* loc/unloc -------------------------------------------------------------------*) let rec unloc_tree (lt : loc_mlw_tree) : mlw_tree = map_abstract_mlw_tree unloc_term unloc_type unloc_ident lt and unloc_term (t : loc_term) : term = map_abstract_term unloc_term unloc_type unloc_ident t.obj and unloc_type (t : loc_typ) : typ = map_abstract_type unloc_ident unloc_type t.obj and unloc_ident (i : loc_ident) : ident = i.obj let unloc_decl (d : loc_decl) = map_abstract_decl unloc_term unloc_type unloc_ident d.obj let with_dummy_loc o = { obj = o; loc = Location.dummy; } let mk_loc l o = { obj = o; loc = l; } let rec loc_tree (t : mlw_tree) : loc_mlw_tree = map_abstract_mlw_tree loc_term loc_type loc_ident t and loc_term (t : term) : loc_term = with_dummy_loc (map_abstract_term loc_term loc_type loc_ident t) and loc_type (t : typ) : loc_typ = with_dummy_loc (map_abstract_type loc_ident loc_type t) and loc_ident (i : ident) : loc_ident = with_dummy_loc i let loc_decl (d : decl) = with_dummy_loc (map_abstract_decl loc_term loc_type loc_ident d) let loc_field (f : field) = with_dummy_loc (map_abstract_field loc_term loc_type loc_ident f) let deloc x = x.obj (* compare -----------------------------------------------------------------------*) let compare_exn e1 e2 = match e1,e2 with | Enotfound, Enotfound -> true | Ekeyexist, Ekeyexist -> true | Einvalidcaller, Einvalidcaller -> true | Enegassignnat, Enegassignnat -> true | Einvalidcondition, Einvalidcondition -> true | Einvalidstate, Einvalidstate -> true | Ebreak, Ebreak -> true | _ -> false let compare_fmod m1 m2 = match m1,m2 with | Logic,Logic -> true | Rec,Rec -> true | NoMod,NoMod -> true | _ -> false let compare_abstract_type (cmpi : 'i -> 'i -> bool) (cmpt : 't -> 't -> bool) (typ1 : ('i,'t) abstract_type) (typ2 : ('i,'t) abstract_type) = match typ1,typ2 with | Tyint, Tyint -> true | Tyuint, Tyunit -> true | Tybool, Tybool -> true | Tystring, Tystring -> true | Tyrational, Tyrational -> true | Tyaddr, Tyaddr -> true | Tyrole, Tyrole -> true | Tykey, Tykey -> true | Tydate, Tydate -> true | Tyduration, Tyduration -> true | Tytez, Tytez -> true | Tybytes, Tybytes -> true | Tystorage, Tystorage -> true | Tyoperation, Tyoperation -> true | Tyentrysig, Tyentrysig -> true | Tyunit, Tyunit -> true | Tystate, Tystate -> true | Tycontract i1, Tycontract i2 -> cmpi i1 i2 | Tyrecord i1, Tyrecord i2 -> cmpi i1 i2 | Tycoll i1, Tycoll i2 -> cmpi i1 i2 | Tyview i1, Tyview i2 -> cmpi i1 i2 | Tymap i1, Tymap i2 -> cmpi i1 i2 | Tyasset i1, Tyasset i2 -> cmpi i1 i2 | Typartition i1, Typartition i2 -> cmpi i1 i2 | Tyenum i1, Tyenum i2 -> cmpi i1 i2 | Tyoption t1, Tyoption t2 -> cmpt t1 t2 | Tylist t1, Tylist t2 -> cmpt t1 t2 | Tytuple l1, Tytuple l2 -> List.for_all2 cmpt l1 l2 | _ -> false let compare_abstract_formula (cmpe : 'e -> 'e -> bool) (cmpi : 'i -> 'i -> bool) (f1 : ('e,'i) abstract_formula) (f2 : ('e,'i) abstract_formula) : bool = cmpi f1.id f2.id && cmpe f1.form f2.form let compare_abstract_fun_struct (cmpe : 'e -> 'e -> bool) (cmpt : 't -> 't -> bool) (cmpi : 'i -> 'i -> bool) (s1 : ('e,'t,'i) abstract_fun_struct) (s2 : ('e,'t,'i) abstract_fun_struct) : bool = cmpi s1.name s2.name && compare_fmod s1.logic s2.logic && List.for_all2 (fun (i1,t1) (i2,t2) -> cmpi i1 i2 && cmpt t1 t2 ) s1.args s2.args && cmpt s1.returns s2.returns && List.for_all2 cmpe s1.raises s2.raises && List.for_all2 cmpe s1.variants s2.variants && List.for_all2 (compare_abstract_formula cmpe cmpi) s1.requires s2.requires && List.for_all2 (compare_abstract_formula cmpe cmpi) s1.ensures s2.ensures && cmpe s1.body s2.body let rec compare_pattern cmp p1 p2 = match p1,p2 with | Twild, Twild -> true | Tpignore, Tpignore -> true | Tconst i1, Tconst i2 -> cmp i1 i2 | Tpatt_tuple l1, Tpatt_tuple l2 -> List.for_all2 (compare_pattern cmp) l1 l2 | Tpsome i1, Tpsome i2 -> cmp i1 i2 | _,_ -> false let compare_abstract_term (cmpe : 'e -> 'e -> bool) (cmpt : 't -> 't -> bool) (cmpi : 'i -> 'i -> bool) (term1 : ('e,'t,'i) abstract_term) (term2 : ('e,'t,'i) abstract_term) : bool = match term1,term2 with | Tseq l1, Tseq l2 -> List.for_all2 cmpe l1 l2 | Tletin (r1,i1,None,b1,e1),Tletin (r2,i2,None,b2,e2) -> r1 = r2 && cmpi i1 i2 && cmpe b1 b2 && cmpe e1 e2 | Tletfun (s1,e1), Tletfun (s2,e2) -> compare_abstract_fun_struct cmpe cmpt cmpi s1 s2 && cmpe e1 e2 | Tif (i1,t1,None), Tif (i2,t2,None) -> cmpe i1 i2 && cmpe t1 t2 | Tif (i1,t1,Some e1), Tif (i2,t2,Some e2) -> cmpe i1 i2 && cmpe t1 t2 && cmpe e1 e2 | Tmatch (t1,l1), Tmatch (t2,l2) -> cmpe t1 t2 && List.for_all2 (fun (p1,e1) (p2,e2) -> cmpe e1 e2 && compare_pattern cmpi p1 p2 ) l1 l2 | Tapp (f1,a1), Tapp (f2,a2) -> cmpe f1 f2 && List.for_all2 cmpe a1 a2 | Tfor (i1,f1,s1,l1,b1), Tfor (i2,f2,s2,l2,b2) -> cmpi i1 i2 && cmpe f1 f2 && cmpe s1 s2 && List.for_all2 (compare_abstract_formula cmpe cmpi) l1 l2 && cmpe b1 b2 | Ttry (b1,l1), Ttry (b2,l2) -> cmpe b1 b2 && List.for_all2 (fun (exn1,e1) (exn2,e2) -> compare_exn exn1 exn2 && cmpe e1 e2) l1 l2 | Tassert (None,e1), Tassert (None,e2) -> cmpe e1 e2 | Tassert (Some l1,e1), Tassert (Some l2,e2) -> cmpi l1 l2 && cmpe e1 e2 | Tvar i1, Tvar i2 -> cmpi i1 i2 | Ttuple l1, Ttuple l2 -> List.for_all2 cmpe l1 l2 | Ttupleaccess (e1,f1,g1), Ttupleaccess (e2,f2,g2) -> cmpe e1 e2 && f1 = f2 && g1 = g2 | Trecord (None,l1), Trecord (None,l2) -> List.for_all2 (fun (i1,j1) (i2,j2) -> cmpi i1 i2 && cmpe j1 j2) l1 l2 | Trecord (Some e1,l1), Trecord (Some e2,l2) -> cmpe e1 e2 && List.for_all2 (fun (i1,j1) (i2,j2) -> cmpi i1 i2 && cmpe j1 j2) l1 l2 | Tdot (l1,r1), Tdot (l2,r2) -> cmpe r1 r2 && cmpe l1 l2 | Tdoti (l1,r1), Tdoti (l2,r2) -> cmpi r1 r2 && cmpi l1 l2 | Tename,Tename -> true | Tcaller i1, Tcaller i2 -> cmpi i1 i2 | Tentrypoint (i1,e1), Tentrypoint (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tsender i1, Tsender i2 -> cmpi i1 i2 | Ttransferred i1, Ttransferred i2 -> cmpi i1 i2 | Ttransfer (f1,t1), Ttransfer (f2,t2) -> cmpe f1 f2 && cmpe t1 t2 | Tcall (a1,c1,n1,l1), Tcall (a2,c2,n2,l2) -> cmpe a1 a2 && cmpe c1 c2 && cmpi n1 n2 && cmpe l1 l2 | Tmkoperation (a1,c1,l1), Tmkoperation (a2,c2,l2) -> cmpe a1 a2 && cmpe c1 c2 && cmpe l1 l2 | Tfst e1, Tfst e2 -> cmpe e1 e2 | Tsnd e1, Tsnd e2 -> cmpe e1 e2 | Tsndopt e1, Tsndopt e2 -> cmpe e1 e2 | Tabs e1, Tabs e2 -> cmpe e1 e2 | Tnow i1, Tnow i2 -> cmpi i1 i2 | Tchainid i1, Tchainid i2 -> cmpi i1 i2 | Tselfaddress i1, Tselfaddress i2 -> cmpi i1 i2 | Tdefaultaddr, Tdefaultaddr -> true | Temptystr, Temptystr -> true | Tadded a1, Tadded a2 -> cmpi a1 a2 | Trmed a1, Trmed a2 -> cmpi a1 a2 | Tlist l1, Tlist l2 -> List.for_all2 cmpe l1 l2 | Tnil i1, Tnil i2 -> cmpi i1 i2 | Temptycoll i1, Temptycoll i2 -> cmpi i1 i2 | Temptyview i1, Temptyview i2 -> cmpi i1 i2 | Temptyfield i1, Temptyfield i2 -> cmpi i1 i2 | Tcard (i1,e1), Tcard (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tmkcoll (i1,e1), Tmkcoll (i2,e2) -> cmpi i1 i2 && List.for_all2 cmpe e1 e2 | Tmkview (i1,e1), Tmkview (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tcontent (i1,e1), Tcontent (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tcontains (i1,e1,e3), Tcontains (i2,e2,e4) -> cmpi i1 i2 && cmpe e1 e2 && cmpe e3 e4 | Tvcontent (i1,e1), Tvcontent (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tfromfield (i1,e1,f1), Tfromfield (i2,e2,f2) -> cmpi i1 i2 && cmpe e1 e2 && cmpe f1 f2 | Tfromview (i1,e1,f1), Tfromview (i2,e2,f2) -> cmpi i1 i2 && cmpe e1 e2 && cmpe f1 f2 | Ttoview (i1,e1), Ttoview (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tviewtolist (i1,e1,f1), Tviewtolist (i2,e2,f2) -> cmpi i1 i2 && cmpe e1 e2 && cmpe f1 f2 | Telts (i1,e1), Telts (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tshallow (i1,e1,f1), Tshallow (i2,e2,f2) -> cmpi i1 i2 && cmpe e1 e2 && cmpe f1 f2 | Tmlist (l1,e11,i11,i21,i31,e21), Tmlist (l2,e12,i12,i22,i32,e22) -> cmpi l1 l2 && cmpe e11 e12 && cmpi i11 i12 && cmpi i21 i22 && cmpi i31 i32 && cmpe e21 e22 | Tcons (i1,e1,e2), Tcons (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tprepend (i1,e1,e2), Tprepend (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tadd (i1,e1,e2), Tadd (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tvadd (i1,e1,e2), Tvadd (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tremove (i1,e1,e2), Tremove (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tvremove (i1,e1,e2), Tvremove (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tfget (i1,e1,e2), Tfget (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tset (i1,e1,e2,e3), Tset (i2,f1,f2,f3) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 && cmpe e3 f3 | Tcsum (i1,e1), Tcsum (i2,f1) -> cmpi i1 i2 && cmpe e1 f1 | Tvsum (i1,e1,e2), Tvsum (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tcsort (i1,e1), Tcsort (i2,f1) -> cmpi i1 i2 && cmpe e1 f1 | Tvsort (i1,e1,e2), Tvsort (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tnthtuple (i1,i2,e1), Tnthtuple (i3,i4,e2) -> compare i1 i3 = 0 && compare i2 i4 = 0 && cmpe e1 e2 | Tcoll (i1,e1), Tcoll (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tassign (e1,e2), Tassign (f1,f2) -> cmpe e1 f1 && cmpe e2 f2 | Traise e1, Traise e2 -> compare_exn e1 e2 | Texn e1, Texn e2 -> compare_exn e1 e2 | Tconcat (e1,e2), Tconcat (f1,f2) -> cmpe e1 f1 && cmpe e2 f2 | Tmktr (e1,e2), Tmktr (f1,f2) -> cmpe e1 f1 && cmpe e2 f2 | Ttradd i1, Ttradd i2 -> cmpi i1 i2 | Ttrrm i1, Ttrrm i2 -> cmpi i1 i2 | Tplus (t1,l1,r1), Tplus (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tminus (t1,l1,r1), Tminus (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tuminus (t1,e1), Tuminus (t2,e2) -> cmpt t1 t2 && cmpe e1 e2 | Tmult (t1,l1,r1), Tmult (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tdiv (t1,l1,r1), Tdiv (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tmod (t1,l1,r1), Tmod (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tnot e1, Tnot e2 -> cmpe e1 e2 | Tpand (e1,e2), Tpand (e3,e4) -> cmpe e1 e3 && cmpe e2 e4 | Teq (i1,l1,r1), Teq (i2,l2,r2) -> cmpt i1 i2 && cmpe l1 l2 && cmpe r1 r2 | Teqfield (i1,l1,r1), Teqfield (i2,l2,r2) -> cmpi i1 i2 && cmpe l1 l2 && cmpe r1 r2 | Tneq (t1,l1,r1), Tneq (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tlt (t1,l1,r1), Tlt (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tle (t1,l1,r1), Tle (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tgt (t1,l1,r1), Tgt (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tge (t1,l1,r1), Tge (t2,l2,r2) -> cmpt t1 t2 && cmpe l1 l2 && cmpe r1 r2 | Tdlt (t1,e1,e2,e3), Tdlt (t2,f1,f2,f3) -> cmpt t1 t2 && cmpe e1 f1 && cmpe e2 f2 && cmpe e3 f3 | Tdle (t1,e1,e2,e3), Tdle (t2,f1,f2,f3) -> cmpt t1 t2 && cmpe e1 f1 && cmpe e2 f2 && cmpe e3 f3 | Tdlet (t1,e1,e2,e3), Tdlet (t2,f1,f2,f3) -> cmpt t1 t2 && cmpe e1 f1 && cmpe e2 f2 && cmpe e3 f3 | Tdlte (t1,e1,e2,e3), Tdlte (t2,f1,f2,f3) -> cmpt t1 t2 && cmpe e1 f1 && cmpe e2 f2 && cmpe e3 f3 | Tint i1, Tint i2 -> compare i1 i2 = 0 | Tstring s1, Tstring s2 -> compare s1 s2 = 0 | Taddr s1, Taddr s2 -> compare s1 s2 = 0 | Tbytes s1, Tbytes s2 -> compare s1 s2 = 0 | Tforall (l1,e1), Tforall (l2,e2) -> List.for_all2 (fun (i1,t1) (i2,t2) -> List.for_all2 cmpi i1 i2 && cmpt t1 t2 ) l1 l2 && cmpe e1 e2 | Texists (l1,e1), Texists (l2,e2) -> List.for_all2 (fun (i1,t1) (i2,t2) -> List.for_all2 cmpi i1 i2 && cmpt t1 t2 ) l1 l2 && cmpe e1 e2 | Timpl (e1,e2), Timpl (f1,f2) -> cmpe e1 f1 && cmpe e2 f2 | Tor (e1,e2), Tor (f1,f2) -> cmpe e1 f1 && cmpe e2 f2 | Tand (e1,e2), Tand (f1,f2) -> cmpe e1 f1 && cmpe e2 f2 | Told e1, Told e2 -> cmpe e1 e2 | Tfalse, Tfalse -> true | Ttrue, Ttrue -> true | Tunion (i1,e1,e2), Tunion (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tinter (i1,e1,e2), Tinter (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tdiff (i1,e1,e2), Tdiff (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tsubset (i1,e1,e2), Tsubset (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tresult, Tresult -> true | Tmem (t1,e1,e2), Tmem (t2,f1,f2) -> cmpi t1 t2 && cmpe e1 f1 && cmpe e2 f2 | Tvmem (t1,e1,e2), Tvmem (t2,f1,f2) -> cmpi t1 t2 && cmpe e1 f1 && cmpe e2 f2 | Tlmem (t1,e1,e2), Tlmem (t2,f1,f2) -> cmpi t1 t2 && cmpe e1 f1 && cmpe e2 f2 | Tccontains (t1,e1,e2), Tccontains (t2,f1,f2) -> cmpi t1 t2 && cmpe e1 f1 && cmpe e2 f2 | Tvcontains (t1,e1,e2), Tvcontains (t2,f1,f2) -> cmpi t1 t2 && cmpe e1 f1 && cmpe e2 f2 | Tempty (i1,e1), Tempty (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tvempty (i1,e1), Tvempty (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tsingl (i1,e1), Tsingl (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tvhead (i1,e1,e2), Tvhead (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tchead (i1,e1,f1), Tchead (i2,e2,f2) -> cmpi i1 i2 && cmpe e1 e2 && cmpe f1 f2 | Tctail (i1,e1,e2), Tctail (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tvtail (i1,e1,e2), Tvtail (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tcnth (i1,e1,e2), Tcnth (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tvnth (i1,e1,e2), Tvnth (i2,f1,f2) -> cmpi i1 i2 && cmpe e1 f1 && cmpe e2 f2 | Tselect (i1,i2,l1,e1), Tselect (i3,i4,l2,e2) -> cmpi i1 i3 && cmpi i2 i4 && List.for_all2 cmpe l1 l2 && cmpe e1 e2 | Tcselect (i1,i2,l1,e1), Tcselect (i3,i4,l2,e2) -> cmpi i1 i3 && cmpi i2 i4 && List.for_all2 cmpe l1 l2 && cmpe e1 e2 | Tvselect (i1,i2,l1,e1,f1), Tvselect (i3,i4,l2,e2,f2) -> cmpi i1 i3 && cmpi i2 i4 && List.for_all2 cmpe l1 l2 && cmpe e1 e2 && cmpe f1 f2 | Tremoveif (i1,i2,l1,e1), Tremoveif (i3,i4,l2,e2) -> cmpi i1 i3 && cmpi i2 i4 && List.for_all2 cmpe l1 l2 && cmpe e1 e2 | Tpremoveif (i1,i2,l1,e1,f1), Tpremoveif (i3,i4,l2,e2,f2) -> cmpi i1 i3 && cmpi i2 i4 && List.for_all2 cmpe l1 l2 && cmpe e1 e2 && cmpe f1 f2 | Tfremoveif (i1,i2,l1,e1,f1,j1), Tfremoveif (i3,i4,l2,e2,f2,j2) -> cmpi i1 i3 && cmpi i2 i4 && List.for_all2 cmpe l1 l2 && cmpe e1 e2 && cmpe f1 f2 && cmpe j1 j2 | Tunionpred (i1,i2,l1,e1), Tunionpred (i3,i4,l2,e2) -> cmpi i1 i3 && cmpi i2 i4 && List.for_all2 cmpe l1 l2 && cmpe e1 e2 | Twitness i1, Twitness i2 -> cmpi i1 i2 | Tnone, Tnone -> true | Tsome e1, Tsome e2 -> cmpe e1 e2 | Tenum i1, Tenum i2 -> cmpi i1 i2 | Tmark (i1,e1), Tmark (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tat (i1,e1), Tat (i2,e2) -> cmpi i1 i2 && cmpe e1 e2 | Tunit, Tunit -> true | Tnottranslated, Tnottranslated -> true | Ttobereplaced, Ttobereplaced -> true | _ -> false (* TODO : compare exception ? *) (* replace --------------------------------------------------------------------*) let cmp_loc_ident (i1 : loc_ident) (i2 : loc_ident) = compare i1.obj i2.obj = 0 let rec cmp_loc_type (t1 : loc_typ) (t2 : loc_typ) : bool = compare_abstract_type cmp_loc_ident cmp_loc_type t1.obj t2.obj let rec cmp_loc_term (e1 : loc_term) (e2 : loc_term) : bool = compare_abstract_term cmp_loc_term cmp_loc_type cmp_loc_ident e1.obj e2.obj let cmp_ident (i1 : ident) (i2 : ident) = compare i1 i2 = 0 let rec cmp_type (t1 : typ) (t2 : typ) = compare_abstract_type cmp_ident cmp_type t1 t2 let rec cmp_term (e1 : term) (e2 : term) : bool = compare_abstract_term cmp_term cmp_type cmp_ident e1 e2 let id x = x (* replaces t1 by t2 in t3 *) let rec loc_replace t1 t2 t3 = if cmp_loc_term t1 t3 then t2 else mk_loc t3.loc (map_abstract_term (loc_replace t1 t2) id id t3.obj) let rec replace t1 t2 t3 = if cmp_term t1 t3 then t2 else map_abstract_term (replace t1 t2) id id t3
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>