Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
File size: 72,494 Bytes
4365a98 |
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 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 |
:: Zero Based Finite Sequences
:: by Tetsuya Tsunetou , Grzegorz Bancerek and Yatsuka Nakamura
environ
vocabularies NUMBERS, SUBSET_1, FUNCT_1, ARYTM_3, XXREAL_0, XBOOLE_0, TARSKI,
NAT_1, ORDINAL1, FINSEQ_1, CARD_1, FINSET_1, RELAT_1, PARTFUN1, FUNCOP_1,
ORDINAL4, ORDINAL2, ARYTM_1, REAL_1, ZFMISC_1, FUNCT_4, VALUED_0,
AFINSQ_1, PRGCOR_2, CAT_1, AMISTD_1, AMISTD_3, AMISTD_2, VALUED_1,
CONNSP_3, XCMPLX_0;
notations TARSKI, XBOOLE_0, ZFMISC_1, SUBSET_1, RELAT_1, FUNCT_1, ORDINAL1,
CARD_1, ORDINAL2, NUMBERS, ORDINAL4, XCMPLX_0, XREAL_0, NAT_1, PARTFUN1,
BINOP_1, FINSOP_1, NAT_D, FINSET_1, FINSEQ_1, FUNCOP_1, FUNCT_4, FUNCT_7,
XXREAL_0, VALUED_0, VALUED_1;
constructors WELLORD2, FUNCT_4, XXREAL_0, ORDINAL4, FUNCT_7, ORDINAL3,
VALUED_1, ENUMSET1, NAT_D, XXREAL_2, BINOP_1, FINSOP_1, RELSET_1, CARD_1,
NUMBERS;
registrations XBOOLE_0, SUBSET_1, RELAT_1, FUNCT_1, ORDINAL1, FUNCOP_1,
XXREAL_0, XREAL_0, NAT_1, CARD_1, ORDINAL2, NUMBERS, VALUED_1, XXREAL_2,
MEMBERED, FINSET_1, FUNCT_4, FINSEQ_1, INT_1;
requirements REAL, NUMERALS, SUBSET, BOOLE, ARITHM;
definitions TARSKI, ORDINAL1, XBOOLE_0, RELAT_1, PARTFUN1, CARD_1;
equalities ORDINAL1, FUNCOP_1, VALUED_1;
expansions TARSKI, ORDINAL1, RELAT_1, CARD_1, FUNCT_1;
theorems TARSKI, AXIOMS, FUNCT_1, NAT_1, ZFMISC_1, RELAT_1, RELSET_1,
ORDINAL1, CARD_1, FINSEQ_1, FUNCT_7, ORDINAL4, CARD_2, FUNCT_4, ORDINAL3,
XBOOLE_0, XBOOLE_1, FINSET_1, FUNCOP_1, XREAL_1, VALUED_0, ENUMSET1,
XXREAL_0, XREAL_0, GRFUNC_1, XXREAL_2, NAT_D, VALUED_1, XTUPLE_0,
FINSEQ_3, ORDINAL2, INT_1;
schemes FUNCT_1, SUBSET_1, NAT_1, XBOOLE_0, CLASSES1, FINSEQ_1;
begin
reserve k,n for Nat,
x,y,z,y1,y2 for object,X,Y for set,
f,g for Function;
:: Extended Segments of Natural Numbers
theorem Th0: ::: CHORD:1 moved eventually from there -> go to INT_1
for n being non zero Nat holds n-1 is Nat & 1 <= n
proof
let n be non zero Nat;
A1: 0+1 <= n by NAT_1:13;
then 0+1-1 <= n-1 by XREAL_1:9;
then n-1 in NAT by INT_1:3;
hence n-1 is Nat;
thus thesis by A1;
end;
theorem Th1:
Segm n \/ { n } = Segm(n+1)
proof
n in Segm(n+1) by NAT_1:45;
then
A1:{n} c= Segm(n+1) by ZFMISC_1:31;
Segm n c= Segm(n+1) by NAT_1:39,11;
hence Segm n \/ { n } c= Segm(n+1) by A1,XBOOLE_1:8;
let x be object;
assume
A2: x in Segm(n+1);
then reconsider x as Nat;
now
x < n+1 by A2,NAT_1:44;
then per cases by NAT_1:22;
case x < n;
hence x in Segm n by NAT_1:44;
end;
case x = n;
hence x in {n} by TARSKI:def 1;
end;
end;
hence thesis by XBOOLE_0:def 3;
end;
theorem Th2:
Seg n c= Segm(n+1)
proof
let x be object;
assume
A1: x in Seg n;
then reconsider x as Element of NAT;
x<=n by A1,FINSEQ_1:1;
then x<n+1 by NAT_1:13;
hence thesis by NAT_1:44;
end;
theorem
n+1 = {0} \/ Seg n
proof
thus n+1 c= {0} \/ Seg n
proof
let x be object;
assume x in n+1;
then x in {j where j is Nat: j<n+1} by AXIOMS:4;
then consider j being Nat such that
A1: j=x and
A2: j<n+1;
j=0 or 1<j+1 & j<=n by A2,NAT_1:13,XREAL_1:29;
then j=0 or 1<=j & j<=n by NAT_1:13;
then x in {0} or x in Seg n by A1,FINSEQ_1:1,TARSKI:def 1;
hence thesis by XBOOLE_0:def 3;
end;
A3: Segm 1 c= Segm(n+1) by NAT_1:39,11;
Seg(n) c= Segm(n+1) by Th2;
hence thesis by A3,CARD_1:49,XBOOLE_1:8;
end;
:: Finite ExFinSequences
theorem
for r being Function holds r is finite Sequence-like iff
ex n st dom r = n by FINSET_1:10;
definition
mode XFinSequence is finite Sequence;
end;
reserve p,q,r,s,t for XFinSequence;
registration let p;
cluster dom p -> natural;
coherence;
end;
notation let p;
synonym len p for card p;
end;
registration let p;
identify len p with dom p;
compatibility
proof
thus len p = card dom p by CARD_1:62
.= dom p;
end;
identify dom p with len p;
compatibility;
end;
definition let p;
redefine func len p -> Element of NAT;
coherence
proof
card p = card p;
hence thesis;
end;
end;
definition let p;
redefine func dom p -> Subset of NAT;
coherence
proof
{i where i is Nat:i<len p} c= NAT
proof
let x be object;
assume x in {i where i is Nat:i<len p};
then ex i being Nat st i=x & i<len p;
hence thesis by ORDINAL1:def 12;
end;
hence thesis by AXIOMS:4;
end;
end;
theorem
(ex k st dom f c= k) implies ex p st f c= p
proof
given k such that
A1: dom f c= k;
deffunc F(object) = f.$1;
consider g such that
A2: dom g = k &
for x being object st x in k holds g.x = F(x) from FUNCT_1:sch 3;
reconsider g as XFinSequence by A2,FINSET_1:10,ORDINAL1:def 7;
take g;
let y,z be object;
assume A3: [y,z] in f;
then
A4: y in dom f by XTUPLE_0:def 12;
then
A5: [y,g.y] in g by A1,A2,FUNCT_1:1;
z is set by TARSKI:1;
then f.y = z by A3,A4,FUNCT_1:def 2;
hence thesis by A1,A2,A4,A5;
end;
scheme XSeqEx{A()->Nat,P[object,object]}:
ex p st dom p = A() & for k st k in A() holds P[k,p.k]
provided
A1: for k st k in A() ex x being object st P[k,x]
proof
A2: for x being object st x in A() ex y being object st P[x,y]
proof
let x be object;
assume
A3: x in A();
A()={i where i is Nat: i<A()} by AXIOMS:4;
then ex i being Nat st i=x & i<A() by A3;
hence thesis by A1,A3;
end;
consider f being Function such that
A4: dom f = A() &
for x being object st x in A() holds P[x,f.x] from CLASSES1:sch 1(A2);
reconsider p=f as XFinSequence by A4,FINSET_1:10,ORDINAL1:def 7;
take p;
thus thesis by A4;
end;
scheme
XSeqLambda{A()->Nat,F(object) -> object}:
ex p being XFinSequence st len p = A() &
for k st k in A() holds p.k=F(k) proof
consider f being Function such that
A1: dom f = A() &
for x being object st x in A() holds f.x=F(x) from FUNCT_1:sch 3;
reconsider p=f as XFinSequence by A1,FINSET_1:10,ORDINAL1:def 7;
take p;
thus thesis by A1;
end;
theorem
z in p implies ex k st k in dom p & z=[k,p.k]
proof
assume
A1: z in p;
then consider x,y being object such that
A2: z=[x,y] by RELAT_1:def 1;
x in dom p by A1,A2,FUNCT_1:1;
then reconsider k = x as Element of NAT;
take k;
thus thesis by A1,A2,FUNCT_1:1;
end;
theorem
dom p = dom q & (for k st k in dom p holds p.k = q.k) implies p = q;
Lm1: k < len p iff k in dom p
proof
thus k < len p implies k in dom p
proof assume k < len p;
then k in Segm len p by NAT_1:44;
hence k in dom p;
end;
assume k in dom p;
then k in Segm len p;
hence k < len p by NAT_1:44;
end;
theorem Th8:
( len p = len q & for k st k < len p holds p.k=q.k ) implies p=q
proof
assume that
A1: len p = len q and
A2: for k st k<len p holds p.k = q.k;
for x being object st x in dom p holds p.x = q.x by A2,Lm1;
hence thesis by A1;
end;
registration let p,n;
cluster p|n -> finite;
coherence;
end;
theorem
rng p c= dom f implies f*p is XFinSequence
proof
assume rng p c= dom f;
then dom(f*p) = len p by RELAT_1:27;
hence thesis by ORDINAL1:def 7;
end;
theorem Th10:
k <= len p implies dom(p|k) = k
proof assume k <= len p;
then Segm k c= Segm len p by NAT_1:39;
hence dom(p|k) = k by RELAT_1:62;
end;
:: XFinSequences of D
registration let D be set;
cluster finite for Sequence of D;
existence
proof
{} is Sequence of D by ORDINAL1:30;
hence thesis;
end;
end;
definition let D be set;
mode XFinSequence of D is finite Sequence of D;
end;
theorem Th11:
for D being set, f being XFinSequence of D holds f is PartFunc of NAT,D
proof
let D be set, f be XFinSequence of D;
dom f c= NAT & rng f c= D by RELAT_1:def 19;
hence thesis by RELSET_1:4;
end;
registration
cluster empty -> Sequence-like for Function;
coherence;
end;
reserve D for set;
registration
let k be Nat, a be object;
cluster Segm k --> a -> finite Sequence-like;
coherence;
end;
::$CT
theorem Th12:
for D being non empty set ex p being XFinSequence of D st len p = k
proof
let D be non empty set;
set y = the Element of D;
set p = k --> y;
reconsider p = k --> y as XFinSequence;
reconsider p as XFinSequence of D;
take p;
thus thesis;
end;
:: ::
:: The Empty XFinSequence ::
:: ::
theorem
len p = 0 iff p = {};
theorem Th14:
for D be set holds {} is XFinSequence of D
proof
let D be set;
rng {} c= D;
hence thesis by RELAT_1:def 19;
end;
registration let D be set;
cluster empty for XFinSequence of D;
existence
proof
{} is XFinSequence of D by Th14;
hence thesis;
end;
end;
registration
let D be non empty set;
cluster non empty for XFinSequence of D;
existence
proof
set k = 1;
consider p being XFinSequence of D such that
A1: len p = k by Th12;
p <> {} by A1;
hence thesis;
end;
end;
definition let x;
func <%x%> -> set equals
0 .--> x;
coherence;
end;
registration let x;
cluster <%x%> -> non empty;
coherence;
end;
definition let D be set;
func <%>D -> XFinSequence of D equals
{};
coherence by Th14;
end;
registration
let D be set;
cluster <%>D -> empty;
coherence;
end;
definition let p,q;
redefine func p^q means
:Def3: dom it = len p + len q & (for k st k in dom p
holds it.k=p.k) & for k st k in dom q holds it.(len p + k) = q.k;
compatibility
proof
let pq be Sequence;
A1: len p +^ len q = len p + len q by CARD_2:36;
hereby
assume
A2: pq = p^q;
hence dom pq = len p + len q by A1,ORDINAL4:def 1;
thus for k st k in dom p holds pq.k=p.k by A2,ORDINAL4:def 1;
let k;
assume k in dom q;
then pq.(len p +^ k) = q.k & k in NAT by A2,ORDINAL4:def 1;
hence pq.(len p + k) = q.k by CARD_2:36;
end;
assume that
A3: dom pq = len p + len q and
A4: for k st k in dom p holds pq.k=p.k and
A5: for k st k in dom q holds pq.(len p + k) = q.k;
A6: now
let a be Ordinal;
assume
A7: a in dom q;
then reconsider k = a as Element of NAT;
thus pq.(dom p +^ a) = pq.(len p + k) by CARD_2:36
.= q.a by A5,A7;
end;
for a be Ordinal st a in dom p holds pq.a = p.a by A4;
hence thesis by A1,A3,A6,ORDINAL4:def 1;
end;
end;
registration
let p,q;
cluster p^q -> finite;
coherence
proof
dom (p^q) = (dom p)+^dom q by ORDINAL4:def 1;
hence thesis by FINSET_1:10;
end;
end;
theorem
len(p^q) = len p + len q by Def3;
theorem Th16:
len p <= k & k < len p + len q implies (p^q).k=q.(k-len p)
proof
assume that
A1: len p <= k and
A2: k < len p + len q;
consider m being Nat such that
A3: len p + m = k by A1,NAT_1:10;
k - len p < len p + len q - len p by A2,XREAL_1:14;
then m in dom q by A3,Lm1;
hence thesis by A3,Def3;
end;
theorem Th17:
len p <= k & k < len(p^q) implies (p^q).k = q.(k - len p)
proof
assume that
A1: len p <= k and
A2: k < len(p^q);
k < len p + len q by A2,Def3;
hence thesis by A1,Th16;
end;
theorem Th18:
k in dom (p^q) implies (k in dom p or ex n st n in dom q & k=len
p + n )
proof
assume k in dom(p^q);
then k in Segm(len p + len q) by Def3;
then
A1: k < len p + len q by NAT_1:44;
now
assume len p <= k;
then consider n being Nat such that
A2: k=len p + n by NAT_1:10;
n + len p - len p < len q + len p - len p by A1,A2,XREAL_1:14;
hence thesis by A2,Lm1;
end;
hence thesis by Lm1;
end;
theorem Th19:
for p,q being Sequence holds dom p c= dom(p^q)
proof
let p,q be Sequence;
dom(p^q) = (dom p)+^(dom q) by ORDINAL4:def 1;
hence thesis by ORDINAL3:24;
end;
theorem Th20:
x in dom q implies ex k st k=x & len p + k in dom(p^q)
proof
assume
A1: x in dom q;
then reconsider k=x as Element of NAT;
take k;
len p + k < len p + len q by XREAL_1:8,A1,Lm1;
then len p + k in Segm(len p + len q) by NAT_1:44;
hence thesis by Def3;
end;
theorem Th21:
k in dom q implies len p + k in dom(p^q)
proof
assume k in dom q;
then ex n st n=k & len p + n in dom(p^q) by Th20;
hence thesis;
end;
theorem
rng p c= rng(p^q)
proof
A1: dom p c= dom(p^q) by Th19;
let x be object;
assume x in rng p;
then consider y being object such that
A2: y in dom p and
A3: x=p.y by FUNCT_1:def 3;
reconsider k=y as Element of NAT by A2;
(p^q).k=p.k by A2,Def3;
hence x in rng(p^q) by A2,A3,A1,FUNCT_1:3;
end;
theorem
rng q c= rng(p^q)
proof
let x be object;
assume x in rng q;
then consider y being object such that
A1: y in dom q and
A2: x=q.y by FUNCT_1:def 3;
reconsider k=y as Element of NAT by A1;
len p + k in dom(p^q) & (p^q).(len p + k) = q.k by A1,Def3,Th21;
hence x in rng(p^q) by A2,FUNCT_1:3;
end;
theorem Th24: ::: ORDINAL4:2
rng(p^q) = rng p \/ rng q by ORDINAL4:2;
theorem Th25:
p^q^r = p^(q^r)
proof
A1: for k st k in dom p holds ((p^q)^r).k=p.k
proof
let k;
assume
A2: k in dom p;
dom p c= dom(p^q) by Th19;
hence (p^q^r).k=(p^q).k by A2,Def3
.=p.k by A2,Def3;
end;
A3: for k st k in dom(q^r) holds ((p^q)^r).(len p + k)=(q^r).k
proof
let k;
assume
A4: k in dom(q^r);
A5: now
assume not k in dom q;
then consider n such that
A6: n in dom r and
A7: k=len q + n by A4,Th18;
thus (p^q^r).(len p + k) =(p^q^r).(len p + len q + n) by A7
.=(p^q^r).(len(p^q) + n) by Def3
.=r.n by A6,Def3
.=(q^r).k by A6,A7,Def3;
end;
now
assume
A8: k in dom q;
then (len p + k) in dom(p^q) by Th21;
hence (p^q^r).(len p + k) = (p^q).(len p + k) by Def3
.=q.k by A8,Def3
.=(q^r).k by A8,Def3;
end;
hence thesis by A5;
end;
dom ((p^q)^r) = (len (p^q) + len r) by Def3
.= (len p + len q + len r) by Def3
.= (len p + (len q + len r))
.= (len p + len(q^r)) by Def3;
hence thesis by A1,A3,Def3;
end;
theorem Th26:
p^r = q^r or r^p = r^q implies p = q
proof
A1: now
assume
A2: p^r = q^r;
then len p + len r = len(q^r) by Def3;
then
A3: len p + len r = len q + len r by Def3;
for k st k in dom p holds p.k=q.k
proof
let k;
assume
A4: k in dom p;
hence p.k=(q^r).k by A2,Def3
.=q.k by A3,A4,Def3;
end;
hence thesis by A3;
end;
A5: now
assume
A6: r^p=r^q;
then
A7: len r + len p = len(r^q) by Def3
.=len r + len q by Def3;
for k st k in dom p holds p.k=q.k
proof
let k;
assume
A8: k in dom p;
hence p.k = (r^q).(len r + k) by A6,Def3
.= q.k by A7,A8,Def3;
end;
hence thesis by A7;
end;
assume p^r = q^r or r^p = r^q;
hence thesis by A1,A5;
end;
registration let p;
reduce p^{} to p;
reducibility
proof
A1: for k st k in dom p holds p.k=(p^{}).k by Def3;
dom(p^{}) = len p + len {} by Def3
.= dom p;
hence p^{} = p by A1;
end;
reduce {}^p to p;
reducibility
proof
A2: for k st k in dom p holds p.k = ({}^p).k
proof
let k;
assume
A3: k in dom p;
thus ({}^p).k =({}^p).(len {} + k)
.=p.k by A3,Def3;
end;
dom({}^p) = (len {} + len p) by Def3
.= dom p;
hence thesis by A2;
end;
end;
::$CT
theorem Th27:
p^q = {} implies p={} & q={}
proof
assume p^q={};
then 0 = len (p^q)
.= len p + len q by Def3;
hence thesis;
end;
registration
let D be set;
let p,q be XFinSequence of D;
cluster p^q -> D-valued;
coherence
proof
A1: rng q c= D by RELAT_1:def 19;
rng(p^q) = rng p \/ rng q & rng p c= D by Th24,RELAT_1:def 19;
hence thesis by A1,XBOOLE_1:8;
end;
end;
Lm2: for x1, y1 being set holds [x,y] in {[x1,y1]} implies x = x1 & y = y1
proof
let x1, y1 be set;
assume [x,y] in {[x1,y1]};
then [x,y] = [x1,y1] by TARSKI:def 1;
hence thesis by XTUPLE_0:1;
end;
definition
let x;
redefine func <%x%> -> Function means
:Def4:
dom it = 1 & it.0 = x;
coherence;
compatibility
proof
let f be Function;
thus f = <%x%> implies dom f = 1 & f.0 = x by CARD_1:49,FUNCOP_1:72;
assume that
A1: dom f = 1 and
A2: f.0 = x;
reconsider g = { [0,f.0] } as Function;
for y,z being object holds [y,z] in f iff [y,z] in g
proof let y,z be object;
hereby
assume
A3: [y,z] in f;
then y in {0} by A1,CARD_1:49,XTUPLE_0:def 12;
then
A4: y = 0 by TARSKI:def 1;
A5: rng f = {f.0} by A1,CARD_1:49,FUNCT_1:4;
z in rng f by A3,XTUPLE_0:def 13;
then z = f.0 by A5,TARSKI:def 1;
hence [y,z] in g by A4,TARSKI:def 1;
end;
assume [y,z] in g;
then
A6: y = 0 & z = f.0 by Lm2;
0 in dom f by A1,CARD_1:49,TARSKI:def 1;
hence thesis by A6,FUNCT_1:def 2;
end;
then f = { [0,f.0] };
hence thesis by A2,FUNCT_4:82;
end;
end;
registration
let x;
cluster <%x%> -> Function-like Relation-like;
coherence;
end;
registration
let x;
cluster <%x%> -> finite Sequence-like;
coherence by Def4;
end;
theorem
p^q is XFinSequence of D implies p is XFinSequence of D & q is
XFinSequence of D
proof
assume p^q is XFinSequence of D;
then rng(p^q) c= D by RELAT_1:def 19;
then
A1: rng p \/ rng q c= D by Th24;
rng p c= rng p \/ rng q by XBOOLE_1:7;
then rng p c= D by A1;
hence p is XFinSequence of D by RELAT_1:def 19;
rng q c= rng p \/ rng q by XBOOLE_1:7;
then rng q c= D by A1;
hence thesis by RELAT_1:def 19;
end;
definition
let x,y;
func <%x,y%> -> set equals
<%x%>^<%y%>;
correctness;
let z;
func <%x,y,z%> -> set equals
<%x%>^<%y%>^<%z%>;
correctness;
end;
registration
let x,y;
cluster <%x,y%> -> Function-like Relation-like;
coherence;
let z;
cluster <%x,y,z%> -> Function-like Relation-like;
coherence;
end;
registration
let x,y;
cluster <%x,y%> -> finite Sequence-like;
coherence;
let z;
cluster <%x,y,z%> -> finite Sequence-like;
coherence;
end;
theorem
<%x%> = { [0,x] } by FUNCT_4:82;
theorem Th30:
p=<%x%> iff dom p = Segm 1 & rng p = {x}
proof
thus p = <%x%> implies dom p = Segm 1 & rng p = {x}
proof
assume
A1: p = <%x%>;
hence dom p = Segm 1 by Def4;
rng p = {p.0} by FUNCT_1:4,A1;
hence thesis by A1,Def4;
end;
assume that
A2: dom p = Segm 1 and
A3: rng p = {x};
1=0+1;
then p.0 in {x} by A2,A3,FUNCT_1:3,NAT_1:45;
then p.0 = x by TARSKI:def 1;
hence thesis by A2,Def4;
end;
theorem Th31:
p = <%x%> iff len p = 1 & p.0 = x by Def4;
registration
let x;
reduce <%x%>.0 to x;
reducibility by Th31;
end;
theorem Th32:
(<%x%>^p).0 = x
proof
0 in 1 by CARD_1:49,TARSKI:def 1;
then 0 in dom <%x%> by Def4;
then (<%x%>^p).0 = <%x%>.0 by Def3;
hence thesis;
end;
theorem Th33:
(p^<%x%>).(len p)=x
proof
A1: dom <%x%> = 1 & 0 in Segm(0+1) by Def4,NAT_1:45;
len p + 0 = len p;
hence (p^<%x%>).(len p) = <%x%>.0 by A1,Def3
.=x;
end;
theorem
<%x,y,z%>=<%x%>^<%y,z%> & <%x,y,z%>=<%x,y%>^<%z%> by Th25;
theorem Th35:
p = <%x,y%> iff len p = 2 & p.0=x & p.1=y
proof
thus p = <%x,y%> implies len p = 2 & p.0=x & p.1=y
proof
assume
A1: p=<%x,y%>;
hence len p = len <%x%> + len <%y%> by Def3
.= 1 + len <%y%> by Th30
.= 1 + 1 by Th30
.=2;
0 in {0} by TARSKI:def 1;
then
A3: 0 in dom <%y%>;
0 in dom <%x%> by TARSKI:def 1;
hence p.0 = <%x%>.0 by A1,Def3
.= x;
thus p.1 = (<%x%>^<%y%>).(len <%x%> + 0) by A1,Th30
.= <%y%>.0 by A3,Def3
.= y;
end;
assume that
A4: len p = 2 and
A5: p.0=x and
A6: p.1=y;
A7: for k st k in dom <%y%> holds p.((len <%x%>)+k)=<%y%>.k
proof
let k;
assume a8: k in dom <%y%>;
thus p.((len <%x%>) + k) = p.(1+k) by Th30
.=p.(1+0) by a8,TARSKI:def 1
.=<%y%>.0 by A6
.= <%y%>.k by a8,TARSKI:def 1;
end;
A9: for k st k in dom <%x%> holds p.k=<%x%>.k
proof
let k;
assume k in dom <%x%>;
then k=0 by TARSKI:def 1;
hence thesis by A5;
end;
dom p = (1+1) by A4
.= (len <%x%> + 1) by Th30
.= (len <%x%> + len <%y%>) by Th30;
hence thesis by A9,A7,Def3;
end;
registration
let x,y;
reduce <%x,y%>.0 to x;
reducibility by Th35;
reduce <%x,y%>.1 to y;
reducibility by Th35;
end;
theorem Th36:
p = <%x,y,z%> iff len p = 3 & p.0 = x & p.1 = y & p.2 = z
proof
thus p = <%x,y,z%> implies len p = 3 & p.0 = x & p.1 = y & p.2 = z
proof
A2: 0 in dom <%x%> by TARSKI:def 1;
A3: 0 in dom <%z%> by TARSKI:def 1;
assume
A4: p =<%x,y,z%>;
hence len p =len <%x,y%> + len <%z%> by Def3
.=2 + len <%z%> by Th35
.=2+1 by Th30
.=3;
thus p.0 = (<%x%>^<%y,z%>).0 by A4,Th25
.=<%x%>.0 by A2,Def3
.=x;
1 in Segm(1+1) & len <%x,y%> = 2 by Th35,NAT_1:45;
hence p.1 =<%x,y%>.1 by A4,Def3
.=y;
thus p.2 =(<%x,y%>^<%z%>).(len (<%x,y%>) + 0) by A4,Th35
.= <%z%>.0 by A3,Def3
.= z;
end;
assume that
A5: len p = 3 and
A6: p.0 = x and
A7: p.1 = y and
A8: p.2 = z;
A9: for k st k in dom <%x,y%> holds p.k=<%x,y%>.k
proof
A10: len <%x,y%> = 2 by Th35;
let k such that
A11: k in dom <%x,y%>;
A12: k=1 implies p.k=<%x,y%>.k by A7;
k=0 implies p.k=<%x,y%>.k by A6;
hence thesis by A11,A10,A12,CARD_1:50,TARSKI:def 2;
end;
A13: for k st k in dom <%z%> holds p.( (len <%x,y%>) + k) = <%z%>.k
proof
let k;
assume k in dom <%z%>;
then
A14: k = 0 by TARSKI:def 1;
hence p.( (len <%x,y%>) + k) = p.(2+0) by Th35
.=<%z%>.k by A8,A14;
end;
dom p = (2+1) by A5
.= ((len <%x,y%>) + 1) by Th35
.= ((len <%x,y%>) + len <%z%>) by Th30;
hence thesis by A9,A13,Def3;
end;
registration
let x,y,z;
reduce <%x,y,z%>.0 to x;
reducibility by Th36;
reduce <%x,y,z%>.1 to y;
reducibility by Th36;
reduce <%x,y,z%>.2 to z;
reducibility by Th36;
end;
registration
let x;
cluster <%x%> -> 1-element;
coherence by Th30;
let y;
cluster <%x,y%> -> 2-element;
coherence by Th35;
let z;
cluster <%x,y,z%> -> 3-element;
coherence by Th36;
end;
registration let n be Nat;
cluster n-element -> n-defined for XFinSequence;
coherence;
end;
registration let n be Nat, x be object;
cluster n --> x -> finite Sequence-like;
coherence;
end;
registration let n be Nat;
cluster n-element for XFinSequence;
existence
proof
take n --> 0;
thus card(n --> 0)= n;
end;
end;
registration let n be Nat;
cluster -> total for n-element n-defined XFinSequence;
coherence
proof let s be n-element XFinSequence;
thus dom s = n by CARD_1:def 7;
end;
end;
theorem Th37:
p <> {} implies ex q,x st p=q^<%x%>
proof
assume p <> {};
then consider n being Nat such that
A1: len p = n+1 by NAT_1:6;
A2: dom p = Segm(n+1) by A1;
reconsider n as Element of NAT by ORDINAL1:def 12;
set q=p| n;
dom q = len p /\ n & Segm n c= Segm len p by A1,NAT_1:11,39,RELAT_1:61;
then
A3: dom q = n by XBOOLE_1:28;
A4: for x being object st x in dom p holds p.x = (q^<%p.(len p - 1)%>).x
proof
let x be object;
assume
A5: x in dom p;
then reconsider k = x as Element of NAT;
A6: now
assume
A7: k in n;
hence p.k=q.k by A3,FUNCT_1:47
.=(q^<%p.(len p - 1)%>).k by A3,A7,Def3;
end;
A8: now
0 in Segm(0+1) by NAT_1:45;
then
A9: 0 in dom <%p.(len p - 1)%> by Def4;
assume
A10: k in {n};
hence (q^<%p.(len p - 1)%>).k =(q^<%p.(len p - 1)%>).(len q + 0) by A3,
TARSKI:def 1
.=<%p.(len p - 1)%>.0 by A9,Def3
.=p.k by A1,A10,TARSKI:def 1;
end;
k in Segm n \/ {n} by A5,Th1,A2;
hence thesis by A6,A8,XBOOLE_0:def 3;
end;
take q;
take p.(len p - 1);
dom(q^<%p.(len p - 1)%>) = (len q + len <%p.(len p - 1)%>) by Def3
.= dom p by A1,A3,Th30;
hence q^<%p.(len p - 1)%>=p by A4;
end;
registration
let D be non empty set;
let d1 be Element of D;
cluster <%d1%> -> D -valued;
coherence;
let d2 be Element of D;
cluster <%d1,d2%> -> D -valued;
coherence;
let d3 be Element of D;
cluster <%d1,d2,d3%> -> D -valued;
coherence;
end;
:: Scheme of induction for extended finite sequences
scheme
IndXSeq{P[XFinSequence]}: for p holds P[p]
provided
A1: P[{}] and
A2: for p,x st P[p] holds P[p^<%x%>]
proof
defpred P1[Real] means for p st len p = $1 holds P[p];
let p;
consider X being Subset of REAL such that
A3: for x being Element of REAL holds x in X iff P1[x] from SUBSET_1:sch 3;
for k holds k in X
proof
A4: 0 in REAL by XREAL_0:def 1;
defpred R[Nat] means $1 in X;
for p st len p = 0 holds P[p]
proof
let p;
assume len p = 0;
then p = {};
hence thesis by A1;
end;
then
A5: R[0] by A3,A4;
A6: for n st R[n] holds R[n+1]
proof
let n;
assume
A7: R[n];
A8: n+1 in REAL by XREAL_0:def 1;
P1[n+1]
proof
let p;
assume
A9: len p = n+1;
then p <> {};
then consider w being XFinSequence, x such that
A10: p = w^<%x%> by Th37;
len p = len w + len <%x%> by A10,Def3
.= len w+1 by Def4;
hence P[p] by A10,A2,A3,A7,A9;
end;
hence thesis by A3,A8;
end;
thus for k holds R[k] from NAT_1:sch 2(A5,A6);
end;
then len p in X;
hence thesis by A3;
end;
theorem
for p,q,r,s being XFinSequence st p^q = r^s & len p <= len r ex t
being XFinSequence st p^t = r
proof
defpred P[XFinSequence] means for p,q,s st p^q=$1^s & len p <= len $1 holds
ex t being XFinSequence st p^t=$1;
A1: for r,x st P[r] holds P[r^<%x%>]
proof
let r,x;
assume
A2: for p,q,s st p^q=r^s & len p <= len r ex t st p^t=r;
let p,q,s;
assume that
A3: p^q=(r^<%x%>)^s and
A4: len p <= len (r^<%x%>);
A5: now
assume len p <> len(r^<%x%>);
then len p <> len r + len <%x%> by Def3;
then
A6: len p <> len r + 1 by Th30;
len p <= len r + len <%x%> by A4,Def3;
then
A7: len p <= len r + 1 by Th30;
p^q=r^(<%x%>^s) by A3,Th25;
then consider t being XFinSequence such that
A8: p^t = r by A2,A6,A7,NAT_1:8;
p^(t^<%x%>) = r^<%x%> by A8,Th25;
hence thesis;
end;
now
assume
A9: len p = len(r^<%x%>);
A10: for k st k in dom p holds p.k=(r^<%x%>).k
proof
let k;
assume
A11: k in dom p;
hence p.k = (r^<%x%>^s).k by A3,Def3
.=(r^<%x%>).k by A9,A11,Def3;
end;
p^{} =r^<%x%> by A9,A10;
hence thesis;
end;
hence thesis by A5;
end;
A12: P[{}]
proof
let p,q,s;
assume that
p^q={}^s and
A13: len p <= len {};
take {};
thus p^{} = {} by A13;
end;
for r holds P[r] from IndXSeq(A12,A1);
hence thesis;
end;
definition
let D be set;
func D^omega -> set means
:Def7:
x in it iff x is XFinSequence of D;
existence
proof
defpred P[object] means $1 is XFinSequence of D;
consider X such that
A1: x in X iff x in bool [:NAT,D:] & P[x] from XBOOLE_0:sch 1;
take X;
let x;
thus x in X implies x is XFinSequence of D by A1;
assume x is XFinSequence of D;
then reconsider p = x as XFinSequence of D;
reconsider p as PartFunc of NAT,D by Th11;
p c= [:NAT,D:];
hence thesis by A1;
end;
uniqueness
proof
defpred P[object] means $1 is XFinSequence of D;
thus for X1,X2 being set st
(for x being object holds x in X1 iff P[x]) &
(
for x being object holds x in X2 iff P[x]) holds X1 = X2
from XBOOLE_0:sch 3;
end;
end;
registration
let D be set;
cluster D^omega -> non empty;
coherence
proof
set f = the XFinSequence of D;
f in D^omega by Def7;
hence thesis;
end;
end;
theorem
x in D^omega iff x is XFinSequence of D by Def7;
theorem
{} in D^omega
proof
{} = <%>D;
hence thesis by Def7;
end;
scheme
SepXSeq{D()->non empty set, P[XFinSequence]}:
ex X st for x holds x in X iff
ex p st p in D()^omega & P[p] & x=p proof
defpred P1[object] means ex p st P[p] & $1=p;
consider Y such that
A1: for x being object holds x in Y iff x in D()^omega & P1[x]
from XBOOLE_0:sch 1;
take Y;
x in Y implies ex p st p in D()^omega & P[p] & x=p
proof
assume x in Y;
then x in D()^omega & ex p st P[p] & x=p by A1;
hence thesis;
end;
hence thesis by A1;
end;
notation
let p be XFinSequence;
let i,x be set;
synonym Replace(p,i,x) for p+*(i,x);
end;
registration
let p be XFinSequence;
let i,x be object;
cluster p+*(i,x) -> finite Sequence-like;
coherence
proof
dom (p+*(i,x)) = dom p by FUNCT_7:30;
hence thesis by FINSET_1:10;
end;
end;
theorem
for p being XFinSequence, i being Element of NAT, x being set holds
len Replace(p,i,x) = len p & (i < len p implies Replace(p,i,x).i = x) & for j
being Element of NAT st j <> i holds Replace(p,i,x).j = p.j
proof
let p be XFinSequence;
let i be Element of NAT, x be set;
set f = Replace(p,i,x);
thus len f = len p by FUNCT_7:30;
i < len p implies not Segm len p c= Segm i by NAT_1:39;
hence i < len p implies f.i = x by FUNCT_7:31,ORDINAL1:16;
thus thesis by FUNCT_7:32;
end;
registration
let D be non empty set;
let p be XFinSequence of D;
let i be Element of NAT, a be Element of D;
cluster Replace(p,i,a) -> D -valued;
coherence
proof
per cases;
suppose
i in dom p;
then Replace(p,i,a) = p+*(i.-->a) by FUNCT_7:def 3;
then
A1: rng Replace(p,i,a) c= rng p \/ rng (i.-->a) by FUNCT_4:17;
rng (i.-->a) = {a} by FUNCOP_1:8;
then
A2: rng (i.-->a) c= D by ZFMISC_1:31;
rng p c= D by RELAT_1:def 19;
then rng p \/ rng (i.-->a) c= D by A2,XBOOLE_1:8;
hence rng Replace(p,i,a) c= D by A1;
end;
suppose
not i in dom p;
then Replace(p,i,a) = p by FUNCT_7:def 3;
hence rng Replace(p,i,a) c= D by RELAT_1:def 19;
end;
end;
end;
:: missing, 2008.02.02, A.K.
registration
cluster -> real-valued for XFinSequence of REAL;
coherence
proof
let F be XFinSequence of REAL;
rng F c= REAL by RELAT_1:def 19;
hence thesis by VALUED_0:def 3;
end;
end;
registration
cluster -> natural-valued for XFinSequence of NAT;
coherence
proof
let F be XFinSequence of NAT;
rng F c= NAT by RELAT_1:def 19;
hence thesis by VALUED_0:def 6;
end;
end;
registration
cluster non empty natural-valued for XFinSequence;
existence
proof
<%0%> is natural-valued & <%0%> is non empty;
hence thesis;
end;
end;
:: 2009.0929, A.T.
theorem Th42:
for x1, x2, x3, x4 being set st
p = <%x1%>^<%x2%>^<%x3%>^<%x4%>
holds len p = 4 & p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4
proof
let x1, x2, x3, x4 be set;
assume
A1: p = <%x1%>^<%x2%>^<%x3%>^<%x4%>;
set p13 = <%x1%>^<%x2%>^<%x3%>;
A2: p13 = <%x1, x2, x3%>;
then
A3: len p13 = 3 by Th36;
A4: p13.0 = x1 & p13.1 = x2 by A2;
A5: p13.2 = x3 by A2;
thus len p = len p13 + len <%x4%> by A1,Def3
.= 3 + 1 by A3,Th30
.= 4;
0 in 3 & 1 in 3 & 2 in 3 by CARD_1:51,ENUMSET1:def 1;
hence p.0 = x1 & p.1 = x2 & p.2 = x3 by A1,A4,A5,Def3,A3;
thus p.3 = p.len p13 by A2,Th36
.= x4 by A1,Th33;
end;
theorem Th43:
for x1, x2, x3, x4, x5 being set st
p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>
holds len p = 5 & p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5
proof
let x1, x2, x3, x4, x5 be set;
assume
A1: p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>;
set p14 = <%x1%>^<%x2%>^<%x3%>^<%x4%>;
A2: len p14 = 4 by Th42;
A3: p14.0 = x1 & p14.1 = x2 by Th42;
A4: p14.2 = x3 & p14.3 = x4 by Th42;
thus len p = len p14 + len <%x5%> by A1,Def3
.= 4 + 1 by A2,Th30
.= 5;
0 in 4 & ... & 3 in 4 by CARD_1:52,ENUMSET1:def 2;
hence p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 by A1,A3,A4,Def3,A2;
thus p.4 = p.len p14 by Th42
.= x5 by A1,Th33;
end;
theorem Th44:
for x1, x2, x3, x4, x5, x6 being set st
p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>
holds len p = 6 & p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5 &
p.5 = x6
proof
let x1, x2, x3, x4, x5, x6 be set;
assume
A1: p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>;
set p15 = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>;
A2: len p15 = 5 by Th43;
A3: p15.0 = x1 & p15.1 = x2 by Th43;
A4: p15.2 = x3 & p15.3 = x4 by Th43;
A5: p15.4 = x5 by Th43;
thus len p = len p15 + len <%x6%> by A1,Def3
.= 5 + 1 by A2,Th30
.= 6;
0 in 5 & ... & 4 in 5 by CARD_1:53,ENUMSET1:def 3;
hence p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5
by A1,A3,A4,A5,Def3,A2;
thus p.5 = p.len p15 by Th43
.= x6 by A1,Th33;
end;
theorem Th45:
for x1, x2, x3, x4, x5, x6, x7 being set st
p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>^<%x7%>
holds len p = 7 & p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5 &
p.5 = x6 & p.6 = x7
proof
let x1, x2, x3, x4, x5, x6, x7 be set;
assume
A1: p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>^<%x7%>;
set p16 = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>;
A2: len p16 = 6 by Th44;
A3: p16.0 = x1 & p16.1 = x2 by Th44;
A4: p16.2 = x3 & p16.3 = x4 by Th44;
A5: p16.4 = x5 & p16.5 = x6 by Th44;
thus len p = len p16 + len <%x7%> by A1,Def3
.= 6 + 1 by A2,Th30
.= 7;
0 in 6 & ... & 5 in 6 by CARD_1:54,ENUMSET1:def 4;
hence p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5 & p.5 = x6
by A1,A3,A4,A5,Def3,A2;
thus p.6 = p.len p16 by Th44
.= x7 by A1,Th33;
end;
theorem Th46:
for x1,x2,x3,x4, x5, x6, x7, x8 being set st
p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>^<%x7%>^<%x8%>
holds len p = 8 & p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5 &
p.5 = x6 & p.6 = x7 & p.7 = x8
proof
let x1, x2, x3, x4, x5, x6, x7, x8 be set;
assume
A1: p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>^<%x7%>^<%x8%>;
set p17 = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>^<%x7%>;
A2: len p17 = 7 by Th45;
A3: p17.0 = x1 & p17.1 = x2 by Th45;
A4: p17.2 = x3 & p17.3 = x4 by Th45;
A5: p17.4 = x5 & p17.5 = x6 by Th45;
A6: p17.6 = x7 by Th45;
thus len p = len p17 + len <%x8%> by A1,Def3
.= 7 + 1 by A2,Th30
.= 8;
0 in 7 & ... & 6 in 7 by CARD_1:55,ENUMSET1:def 5;
hence p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5 & p.5 = x6 &
p.6 = x7 by A1,A3,A4,A5,A6,Def3,A2;
thus p.7 = p.len p17 by Th45
.= x8 by A1,Th33;
end;
theorem
for x1,x2,x3,x4,x5,x6,x7, x8, x9 being set st
p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>^<%x7%>^<%x8%>^<%x9%>
holds len p = 9 & p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5 &
p.5 = x6 & p.6 = x7 & p.7 = x8 & p.8 = x9
proof
let x1, x2, x3, x4, x5, x6, x7, x8, x9 be set;
assume
A1: p = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>^<%x7%>^<%x8%>^<%x9%>;
set p17 = <%x1%>^<%x2%>^<%x3%>^<%x4%>^<%x5%>^<%x6%>^<%x7%>^<%x8%>;
A2: len p17 = 8 by Th46;
A3: p17.0 = x1 & p17.1 = x2 by Th46;
A4: p17.2 = x3 & p17.3 = x4 by Th46;
A5: p17.4 = x5 & p17.5 = x6 by Th46;
A6: p17.6 = x7 & p17.7 = x8 by Th46;
thus len p = len p17 + len <%x9%> by A1,Def3
.= 8 + 1 by A2,Th30
.= 9;
0 in 8 & ... & 7 in 8 by CARD_1:56,ENUMSET1:def 6;
hence p.0 = x1 & p.1 = x2 & p.2 = x3 & p.3 = x4 & p.4 = x5 & p.5 = x6 &
p.6 = x7 & p.7 = x8 by A1,A3,A4,A5,A6,Def3,A2;
thus p.8 = p.len p17 by Th46
.= x9 by A1,Th33;
end;
:: K.P. 12.2009
theorem :: FINSEQ_2:7
n <len p implies (p^q).n=p.n
proof
assume n <len p;
then n in dom p by Lm1;
hence thesis by Def3;
end;
theorem :: FINSEQ_2:10
len p <= n implies (p|n) = p
proof
assume len p<=n;
then Segm len p c= Segm n by NAT_1:39;
hence thesis by RELAT_1:68;
end;
theorem Th50: :: FINSEQ_1:11
n <=len p & k in n
implies (p|n).k = p.k & k in dom p
proof
assume that
A1: n <=len p and
A2: k in n;
A3: Segm n c= Segm len p by A1,NAT_1:39;
then n = dom p /\ n by XBOOLE_1:28
.= dom(p|n) by RELAT_1:61;
hence thesis by A2,A3,FUNCT_1:47;
end;
theorem Th51: :: FINSEQ_1:12
n <= len p implies len(p|n) = n
proof
assume n <= len p;
then Segm n c= Segm len p by NAT_1:39;
hence thesis by RELAT_1:62;
end;
theorem :: FINSEQ_1:13
len(p|n) <= n
proof
Segm len(p|n) c= Segm n by RELAT_1:58;
hence thesis by NAT_1:39;
end;
theorem Th53: :: FINSEQ_1:14
len p = n+1 implies p = (p|n) ^ <% p.n %>
proof
set pn = p|n;
set x=p.n;
assume
A1: len p = n+1;
then A2: n < len p by NAT_1:13;
then A3: len pn = n by Th51;
A4: now
let m be Nat;
assume m in dom p;
then m<len p by Lm1;
then
A5: m <= len pn by A1,A3,NAT_1:13;
now
per cases;
case
m = len pn;
hence p.m = (pn^<%x%>).m by A3,Th33;
end;
case
m <> len pn;
then m< len pn by A5,XXREAL_0:1;
then
A6: m in dom pn by Lm1;
hence (pn^<%x%>).m = pn.m by Def3
.= p.m by A2,A3,A6,Th50;
end;
end;
hence p.m = (pn^<%x%>).m;
end;
len (pn^<%x%>) = n + len <%x%> by A3,Def3
.= len p by A1,Def4;
hence thesis by A4;
end;
theorem Th54: :: CATALAN2:1
(p^q)|dom p = p
proof
set r=(p^q)|(dom p);
A1: now
let k such that
A2: k < len p;
A3: k in dom p by A2,Lm1;
then
A4: (p^q).k=p.k by Def3;
k+0<len p+len q by A2,XREAL_1:8;
then k in Segm(len p+len q) by NAT_1:44;
then k in dom (p^q) by Def3;
then k in dom (p^q)/\ dom p by A3,XBOOLE_0:def 4;
hence r.k=p.k by A4,FUNCT_1:48;
end;
dom p c= dom (p^q) by Th19;
then len r= len p by RELAT_1:62;
hence thesis by A1,Th8;
end;
theorem :: CATALAN2:2
n <= dom p implies (p^q)|n = p|n
proof
assume n <= dom p;
then Segm n c= Segm len p by NAT_1:39;
then ((p^q)|dom p)|n=(p^q)|n by RELAT_1:74;
hence thesis by Th54;
end;
theorem :: CATALAN2:3
n = dom p + k implies (p^q)|n = p^(q|k)
proof
assume
A1: n = dom p + k;
now
per cases;
suppose
A2: n>=len (p^q);
then n>=len p+len q by Def3;
then Segm len q c= Segm k by NAT_1:39,A1,XREAL_1:8;
then
A3: q|k = q by RELAT_1:68;
Segm len(p^q) c= Segm n by A2,NAT_1:39;
hence thesis by A3,RELAT_1:68;
end;
suppose
A4: n<len (p^q);
then
A5: len ((p^q)|n)=n by Th10;
n<len p+len q by A4,Def3;
then k < len q by A1,XREAL_1:6;
then len (q|k)=k by Th10;
then
A6: len (p^(q|k))=len p + k by Def3;
now
let m be Nat such that
A7: m in dom ((p^q)|n);
A8: m < len ((p^q)|n) by A7,Lm1;then
m <len (p^q) by A4,A5,XXREAL_0:2;
then
A9: m in len (p^q) by Lm1;
m in n by A4,Th10,A7;
then
A10: m in dom (p^q) /\ n by A9,XBOOLE_0:def 4;
then
A11: ((p^q)|n).m=(p^q).m by FUNCT_1:48;
now
per cases;
suppose
m<len p;
then m in dom p by Lm1;
then (p^(q|k)).m=p.m & (p^q).m=p.m by Def3;
hence ((p^q)|n).m=(p^(q|k)).m by A10,FUNCT_1:48;
end;
suppose
A12: m>=len p;
m < len (p^q) by A4,A5,A8,XXREAL_0:2;
then
A13: q.(m-len p)=(p^q).m by A12,Th17;
A14: m-len p+len p< len (p^q) by A4,A5,A8,XXREAL_0:2;
A15: m-len p is Nat by A12,NAT_1:21;
len (p^q)=len p+len q by Def3;
then m-len p<len q by A14,XREAL_1:6;
then
A16: m-len p in len q by A15,Lm1;
m-len p < k by A1,A5,A14,A8,XREAL_1:6;
then m-len p in Segm k by A15,NAT_1:44;
then
A17: m-len p in k/\dom q by A16,XBOOLE_0:def 4;
(p^(q|k)).m=(q|k).(m-len p) by A1,A6,A5,A12,A8,Th17;
hence ((p^q)|n).m=(p^(q|k)).m by A11,A13,A17,FUNCT_1:48;
end;
end;
hence ((p^q)|n).m=(p^(q|k)).m;
end;
hence thesis by A6,A1,A4,Th10;
end;
end;
hence thesis;
end;
theorem :: CATALAN2:4
ex q st p = (p|n)^q
proof
now
per cases;
suppose
n > len p;
then Segm len p c= Segm n by NAT_1:39;
then
A1: p|n=p by RELAT_1:68;
p^{}=p;
hence thesis by A1;
end;
suppose
n <= len p;
then reconsider n1=len p-n as Element of NAT by NAT_1:21;
defpred P[Nat] means for k st k= len p-$1 holds ex q st p=(p|k)^q;
A2: for m be Nat st P[m] holds P[m+1]
proof
let m be Nat such that
A3: P[m];
let k such that
A4: k = len p-(m+1);
consider q such that
A5: p=(p|(k+1))^q by A3,A4;
Segm k c= Segm(k+1) by NAT_1:39,11;
then
A6: (p|(k+1))|k =p|k by RELAT_1:74;
len p-m<=len p-0 by XREAL_1:10;
then len (p | (k+1)) = k+1 by Th51,A4;
then p|(k+1)=(p|(k+1))|k^<%(p|(k+1)).k%> by Th53;
then p=(p|k)^(<%(p|(k+1)).k%>^q) by A5,A6,Th25;
hence thesis;
end;
p|(len p-0)=p & p^{}=p;
then
A7: P[0];
A8: for m be Nat holds P[m] from NAT_1:sch 2(A7,A2);
n=len p-n1;
hence thesis by A8;
end;
end;
hence thesis;
end;
theorem :: FLANG_1:10
len p = n + k implies ex q1, q2 being
XFinSequence st len q1 = n & len q2 = k & p = q1 ^ q2
proof
defpred P[Nat] means for p being XFinSequence, i, j be Nat
st len p = $1 & len p =
i + j ex q1, q2 being XFinSequence st len q1 = i & len q2 = j & p = q1 ^ q2;
A1: now
let n;
assume
A2: P[n];
thus P[n + 1]
proof
let p be XFinSequence;
let i, j be Nat;
assume that
A3: len p = n + 1 and
A4: len p = i + j;
per cases;
suppose
A5: j = 0;
take q1 = p;
take q2 = {};
thus thesis by A4,A5;
end;
suppose
j > 0;
then consider k such that
A6: j = k + 1 by NAT_1:6;
p <> {} by A3;
then consider q being XFinSequence, x such that
A7: p = q ^ <%x%> by Th37;
A8: n + 1 = len q + len <%x%> by A3,A7,Def3
.= len q + 1 by Th30;
n = i + k by A3,A4,A6;
then consider q1, q2 being XFinSequence such that
A9: len q1 = i and
A10: len q2 = k and
A11: q = q1 ^ q2 by A2,A8;
A12: len (q2 ^ <%x%>) = len q2 + len <%x%> by Def3
.= j by A6,A10,Th30;
p = q1 ^ (q2 ^ <%x%>) by A7,A11,Th25;
hence thesis by A9,A12;
end;
end;
end;
A13: P[0]
proof
let p be XFinSequence;
let i, j be Nat;
assume that
A14: len p = 0 and
A15: len p = i + j;
A16: p = {} ^ {} by A14;
len {} = i by A14,A15;
hence thesis by A15,A16;
end;
for n holds P[n] from NAT_1:sch 2(A13, A1);
hence thesis;
end;
theorem :: FSM_3:6
<%x%>^p = <%y%>^q implies x = y & p = q
proof
assume A1: <%x%>^p = <%y%>^q;
(<%x%>^p).0 = x by Th32;
then x = y by A1,Th32;
hence thesis by A1,Th26;
end;
definition
let D be set,q be FinSequence of D;
func FS2XFS q -> XFinSequence of D means :Def8:
len it=len q & for i being Nat st i < len q holds q.(i+1)=it.i;
existence
proof
deffunc F(Nat) =q.($1 +1);
ex p being XFinSequence st len p = len q & for k be Nat
st k in len q holds p.k=F(k) from XSeqLambda;
then consider p being XFinSequence such that
A1: len p = len q and
A2: for k be Nat st k in Segm len q holds p.k=F(k);
rng p c= D
proof
let y be object;
A3: rng q c= D by FINSEQ_1:def 4;
assume y in rng p;
then consider x being object such that
A4: x in dom p and
A5: y=p.x by FUNCT_1:def 3;
reconsider nx=x as Element of NAT by A4;
A6: nx+1<=len q by NAT_1:13,A1,A4,Lm1;
0+1<=nx+1 by NAT_1:13;
then nx+1 in Seg len q by A6,FINSEQ_1:1;
then nx+1 in dom q by FINSEQ_1:def 3;
then
A7: q.(nx+1) in rng q by FUNCT_1:def 3;
p.nx= q.(nx +1) by A1,A2,A4;
hence thesis by A5,A7,A3;
end;
then
A8: p is XFinSequence of D by RELAT_1:def 19;
for i being Nat st i<len q holds q.(i+1)=p.i by A2,NAT_1:44;
hence thesis by A1,A8;
end;
uniqueness
proof
thus for p1,p2 being XFinSequence of D st
(len p1=len q & for i be Nat st i<len q holds
q.(i+1)=p1.i)& (len p2=len q & for i be Nat
st i<len q holds q.(i+1)=p2.i) holds
p1=p2
proof
let p1,p2 be XFinSequence of D;
assume that
A9: len p1=len q and
A10: for i be Nat st i<len q holds q.(i+1)=p1.i and
A11: len p2=len q and
A12: for i be Nat st i<len q holds q.(i+1)=p2.i;
for i be Nat st i<len p1 holds p1.i=p2.i
proof
let i be Nat;
assume
A13: i<len p1;
then q.(i+1)=p1.i by A9,A10;
hence thesis by A9,A12,A13;
end;
hence thesis by A9,A11,Th8;
end;
end;
end;
reserve i for Nat;
definition
let q be XFinSequence;
func XFS2FS q -> FinSequence means :Def9A:
len it=len q & for i be Nat st 1<=i & i<= len q holds q.(i-'1)=it.i;
existence
proof
deffunc F(Nat) = q.($1-'1);
ex p being FinSequence st len p = len q &
for k being Nat st k in dom p holds p.k=F(k) from FINSEQ_1:sch 2;
then consider p being FinSequence such that
A1: len p = len q and
A2: for k being Nat st k in dom p holds p.k=F(k);
A11: dom p = Seg len q by A1,FINSEQ_1:def 3;
for i be Nat st 1<=i & i<=len q holds q.(i-'1)=p.i by A2,A11,FINSEQ_1:1;
hence thesis by A1;
end;
uniqueness
proof
thus for p1,p2 being FinSequence st (len p1=len q & for i st 1<=i & i
<=len q holds q.(i-'1)=p1.i)& (len p2=len q & for i st 1<=i & i<=len q holds q.
(i-'1)=p2.i) holds p1=p2
proof
let p1,p2 be FinSequence;
assume that
A12: len p1=len q and
A13: for i st 1<=i & i<=len q holds q.(i-'1)=p1.i and
A14: len p2=len q and
A15: for i st 1<=i & i<=len q holds q.(i-'1)=p2.i;
for i be Nat st 1<=i & i<=len p1 holds p1.i=p2.i
proof
let i be Nat;
assume
A16: 1<=i & i<=len p1;
then q.(i-'1)=p1.i by A12,A13;
hence thesis by A12,A15,A16;
end;
hence thesis by A12,A14,FINSEQ_1:14;
end;
end;
end;
definition
let D be set, q be XFinSequence of D;
redefine func XFS2FS q -> FinSequence of D;
coherence
proof
set p = XFS2FS q;
A1: len p = len q by Def9A;
rng p c= D
proof
let y be object;
A3: rng q c= D by RELAT_1:def 19;
assume y in rng p;
then consider x being object such that
A4: x in dom p and
A5: y=p.x by FUNCT_1:def 3;
reconsider nx=x as Element of NAT by A4;
A6: nx in Seg len q by A1,A4,FINSEQ_1:def 3;
then f: 1<=nx by FINSEQ_1:1;
then nx-1>=0 by XREAL_1:48; then
A7: nx-1=nx-'1 by XREAL_0:def 2;
A8: nx-'1<nx-'1+1 by NAT_1:13;
F: nx<=len q by A6,FINSEQ_1:1;
then nx-'1<len q by A7,A8,XXREAL_0:2;
then a9: nx-'1 in dom q by Lm1;
AA: 1<=nx & nx<=len q by F,f;
A9: q.(nx-'1) in rng q by FUNCT_1:def 3,a9;
p.nx = q.(nx -'1) by Def9A,AA;
hence thesis by A5,A9,A3;
end;
hence thesis by FINSEQ_1:def 4;
end;
end;
theorem
for D being set, n being Nat, r being set st r in D holds
(n-->r) is XFinSequence of D;
definition
let D be non empty set;
let q be FinSequence of D, n be Nat;
assume that
A1: n>len q and
A2: NAT c= D;
func FS2XFS*(q,n) -> non empty XFinSequence of D means
len q = it.0 &
len it=n & (for i be Nat st 1<=i & i<= len q holds it.i=q.i)&
for j being Nat st len q
<j & j<n holds it.j=0;
existence
proof
reconsider x=len q as Element of D by A2;
reconsider r=0 as Element of D by A2;
reconsider q5= ((n-'len q-'1)-->r) as XFinSequence of D;
<%x%> ^ (FS2XFS q) <>{} by Th27;
then reconsider
p0=<%x%> ^ (FS2XFS q)^q5 as non empty XFinSequence of D by Th27;
A3: 0 in dom (<%x%>) by Lm1;
A4: len <%x%>=1 by Def4;
0 in Segm(len <%x%> + len (FS2XFS q)) by NAT_1:44;
then 0 in len (<%x%> ^ (FS2XFS q)) by Def3;
then
A5: p0.0=(<%x%> ^ (FS2XFS q)).0 by Def3
.=(<%x%>).0 by A3,Def3
.=x;
A6: for i st 1<=i & i<= len q holds p0.i=q.i
proof
let i;
assume that
A7: 1<=i and
A8: i<= len q;
A9: i-'1=i-1 by XREAL_0:def 2,A7,XREAL_1:48;
i<i+1 by NAT_1:13;
then i-1<i+1-1 by XREAL_1:9;
then
A10: i-'1 <len q by A8,A9,XXREAL_0:2;
then i-'1 in Segm len q by NAT_1:44;
then
A11: i-'1 in len (FS2XFS q) by Def8;
i<1+len q by A8,NAT_1:13;
then i< (len (<%x%>)+len (FS2XFS q)) by A4,Def8;
then i in Segm(len (<%x%>)+len (FS2XFS q)) by NAT_1:44;
then i in len (<%x%> ^ (FS2XFS q)) by Def3;
then p0.i =(<%x%>^(FS2XFS q)).(1+(i-'1)) by A9,Def3
.=(FS2XFS q).(i-'1) by A4,A11,Def3
.=q.(i-'1+1) by A10,Def8
.=q.i by A9;
hence thesis;
end;
A12: n-len q>0 by A1,XREAL_1:50;
then
A13: n-'len q=n-len q by XREAL_0:def 2;
then n-'len q>=0+1 by A12,NAT_1:13;
then
A14: n-'len q -1>=0 by XREAL_1:48;
A15: len q5=(n-'len q-'1);
A16: for j being Nat st len q<j & j<n holds p0.j=0
proof
let j be Nat;
assume that
A17: len q<j and
A18: j<n;
A19: len (<%x%> ^ (FS2XFS q)) =len (<%x%>) + len (FS2XFS q) by Def3
.=1+len q by A4,Def8;
len q<n by A17,A18,XXREAL_0:2;
then
A20: n-len q>0 by XREAL_1:50;
then
A21: n-'len q=n-len q by XREAL_0:def 2;
then n-len q>=0+1 by A20,NAT_1:13;
then n-'len q-1>=0 by A21,XREAL_1:48;
then
A22: n-'len q-'1 =n-(len q+1) by A21,XREAL_0:def 2;
1+len q<=j by A17,NAT_1:13; then
A23: j-'(1+len q)=j-(1+len q) by XREAL_0:def 2,XREAL_1:48;
j-(len q+1)< n-(len q+1) by A18,XREAL_1:9;
then
A24: j-'len (<%x%> ^ (FS2XFS q)) in Segm(n-'len q-'1) by A19,A23,A22,NAT_1:44;
j =len (<%x%> ^ (FS2XFS q))+(j-'len (<%x%> ^ (FS2XFS q))) by A19,A23;
then p0.j=q5.(j-'len (<%x%> ^ (FS2XFS q))) by A15,A24,Def3
.=0;
hence thesis;
end;
len p0=len (<%x%> ^ (FS2XFS q)) + len q5 by Def3
.=len <%x%> + len (FS2XFS q) + len q5 by Def3
.= 1 + len (FS2XFS q) + len q5 by Th30
.=1 + len q + len q5 by Def8
.=1+len q+(n-'len q-'1)
.=(n-(len q+1))+(len q+1) by A13,A14,XREAL_0:def 2
.=n;
hence thesis by A5,A6,A16;
end;
uniqueness
proof
let p1,p2 be non empty XFinSequence of D;
assume that
A25: len q = (p1.0) and
A26: len p1=n and
A27: for i st 1<=i & i<= len q holds p1.i=q.i and
A28: for j being Nat st len q<j & j<n holds p1.j=0 and
A29: len q = (p2.0) and
A30: len p2=n and
A31: for i st 1<=i & i<= len q holds p2.i=q.i and
A32: for j being Nat st len q<j & j<n holds p2.j=0;
for i be Nat st i<n holds p1.i=p2.i
proof
let i be Nat;
assume i<n; then
A33: i<0+1 or 1<=i & i<=len q or len q<i & i<n;
now
per cases by A33,NAT_1:13;
case i=0;
hence thesis by A25,A29;
end;
case
A34: 1<=i & i<=len q;
then p1.i=q.i by A27;
hence thesis by A31,A34;
end;
case
A35: len q<i & i<n;
then p1.i=0 by A28;
hence thesis by A32,A35;
end;
end;
hence thesis;
end;
hence thesis by A26,A30,Th8;
end;
end;
reserve m for Nat,
D for non empty set;
definition
let D be non empty set;
let p be XFinSequence of D;
assume that
A1: p.0 is Nat and
A2: p.0 in len p;
func XFS2FS*(p) -> FinSequence of D means :Def11:
for m be Nat st m = p.0 holds
len it =m & for i st 1<=i & i<= m holds it.i=p.i;
existence
proof
reconsider m0=p.0 as Element of NAT by A1,ORDINAL1:def 12;
deffunc F(set)= p.$1;
ex q being FinSequence st len q = m0 & for k being Nat st k in dom q
holds q.k=F(k) from FINSEQ_1:sch 2;
then consider q being FinSequence such that
A3: len q = m0 and
A4: for k being Nat st k in dom q holds q.k=F(k);
rng q c= D
proof
A5: m0 < len p by A2,Lm1;
let y be object;
assume y in rng q;
then consider x being object such that
A6: x in dom q and
A7: y=q.x by FUNCT_1:def 3;
reconsider k0=x as Element of NAT by A6;
k0 in Seg m0 by A3,A6,FINSEQ_1:def 3;
then k0<=m0 by FINSEQ_1:1;
then k0 < len p by A5,XXREAL_0:2;
then
A8: k0 in dom p by Lm1;
y=p.k0 by A4,A6,A7;
then rng p c= D & y in rng p by A8,FUNCT_1:def 3,RELAT_1:def 19;
hence thesis;
end;
then reconsider q0=q as FinSequence of D by FINSEQ_1:def 4;
A9: dom q = Seg m0 by A3,FINSEQ_1:def 3;
for m be Nat st
m = (p.0) holds len q0 =m & for i st 1<=i & i<= m holds q0.i =p.i
by A4,A9,FINSEQ_1:1,A3;
hence thesis;
end;
uniqueness
proof
reconsider m2=p.0 as Nat by A1;
let g1,g2 be FinSequence of D;
assume that
A10: for m st m = p.0 holds len g1 =m & for i st 1<=i & i<= m holds g1
.i=p. i and
A11: for m st m = p.0 holds len g2 =m & for i st 1<=i & i<= m holds g2
. i=p.i;
A12: len g1=m2 by A10;
A13: for i be Nat st 1<=i & i<=len g1 holds g1.i=g2.i
proof
let i be Nat;
assume
A14: 1<=i & i<=len g1;
then g1.i=p.i by A10,A12;
hence thesis by A11,A12,A14;
end;
len g2=m2 by A11;
hence thesis by A10,A13,FINSEQ_1:14;
end;
end;
theorem
for p being XFinSequence of D st p.0=0 & 0<len p holds
XFS2FS*(p)={}
proof
let p be XFinSequence of D;
assume that
A1: p.0=0 and
A2: 0<len p;
set q= XFS2FS*(p);
0 in len p by A2,Lm1;
then len q=0 by A1,Def11;
hence thesis;
end;
:: from EXTPRO_1, 2010.01.11, A.T.
definition
let F be Function;
attr F is initial means
:Def12:
for m,n being Nat st n in dom F & m < n holds m in dom F;
end;
registration
cluster empty -> initial for Function;
coherence;
end;
registration
cluster -> initial for XFinSequence;
coherence
proof
let p be XFinSequence;
let m,n being Nat such that
A1: n in dom p;
assume m < n;
then m in Segm n by NAT_1:44;
hence m in dom p by A1,ORDINAL1:10;
end;
end;
:: following, 2010.01.11, A.T.
registration
cluster -> NAT-defined for XFinSequence;
coherence
proof let f be XFinSequence;
thus dom f c= NAT;
end;
end;
theorem Th62:
for F being non empty initial NAT-defined Function holds 0 in dom F
proof
let F be non empty initial NAT-defined Function;
consider x being object such that
A1: x in dom F by XBOOLE_0:def 1;
dom F c= NAT by RELAT_1:def 18;
then reconsider x as Element of NAT by A1;
x = 0 or 0 < x;
hence 0 in dom F by A1,Def12;
end;
registration
cluster initial finite NAT-defined -> Sequence-like for Function;
coherence
proof let F be Function;
assume
A1: F is initial finite NAT-defined;
thus dom F is epsilon-transitive
proof let x be set;
assume
A2: x in dom F;
then reconsider i = x as Nat by A1;
let y be object;
assume y in x; then
A3: y in Segm i;
then reconsider j = y as Nat;
thus y in dom F by A1,A2,NAT_1:44,A3;
end;
let x,y be set;
assume x in dom F & y in dom F;
then reconsider x,y as Ordinal by A1;
x in y or x = y or y in x by ORDINAL1:14;
hence thesis;
end;
end;
theorem
for F being finite initial NAT-defined Function
for n being Nat holds
n in dom F iff n < card F by Lm1;
:: from AMISTD_2, 2010.04.16, A.T.
theorem
for F being initial NAT-defined Function,
G being NAT-defined Function st dom F = dom G holds G is initial by Def12;
theorem
for F being initial NAT-defined finite Function
holds dom F = { k where k is Element of NAT: k < card F }
proof
let F be initial NAT-defined finite Function;
hereby
let x be object;
assume
A1: x in dom F;
then reconsider f = x as Element of NAT;
f < card F by A1,Lm1;
hence x in { k where k is Element of NAT: k < card F };
end;
let x be object;
assume x in { k where k is Element of NAT: k < card F };
then ex k being Element of NAT st x = k & k < card F;
hence thesis by Lm1;
end;
theorem
for F being non empty XFinSequence,
G be non empty NAT-defined finite Function
st F c= G & LastLoc F = LastLoc G
holds F = G
proof
let F be initial non empty NAT-defined finite Function, G be non empty NAT
-defined finite Function such that
A1: F c= G and
A2: LastLoc F = LastLoc G;
dom F = dom G
proof
thus dom F c= dom G by A1,GRFUNC_1:2;
let x be object;
assume
A3: x in dom G;
dom G c= NAT by RELAT_1:def 18;
then reconsider x as Element of NAT by A3;
A4: LastLoc F in dom F by VALUED_1:30;
x <= LastLoc F by A2,A3,VALUED_1:32;
then x < LastLoc F or x = LastLoc F by XXREAL_0:1;
hence thesis by A4,Def12;
end;
hence thesis by A1,GRFUNC_1:3;
end;
theorem Th67:
for F being non empty XFinSequence holds
LastLoc F = card F -' 1
proof
let F be initial non empty NAT-defined finite Function;
consider k being Nat such that
A1: LastLoc F = k;
reconsider k as Element of NAT by ORDINAL1:def 12;
k < card F by A1,Lm1,VALUED_1:30;
then
A2: k <= card F -' 1 by NAT_D:49;
per cases by A2,XXREAL_0:1;
suppose
k < card F -' 1;
then k+1 < card F -' 1 + 1 by XREAL_1:6;
then k+1 < card F by NAT_1:14,XREAL_1:235;
then
A3: k+1 <= k by A1,VALUED_1:32,Lm1;
k <= k+1 by NAT_1:11;
then k+0 = k+1 by A3,XXREAL_0:1;
hence thesis;
end;
suppose
k = card F -' 1;
hence thesis by A1;
end;
end;
theorem
for F being initial non empty NAT-defined finite Function holds
FirstLoc F = 0 by Th62,VALUED_1:35;
registration
let F be initial non empty NAT-defined finite Function;
cluster CutLastLoc F -> initial;
coherence
proof
set G = CutLastLoc F;
per cases;
suppose G is empty;
then reconsider H = G as empty finite Function;
H is initial;
hence thesis;
end;
suppose G is non empty;
then reconsider G as non empty finite Function;
G is initial
proof
let m,l be Nat such that
A1: l in dom G and
A2: m < l;
set M = dom F;
reconsider R = {[LastLoc F, F.LastLoc F]} as Relation;
a3: R = LastLoc F .--> (F.LastLoc F) by FUNCT_4:82; then
A4: dom F \ dom R = dom G by VALUED_1:36; then
l in dom F by A1,XBOOLE_0:def 5; then
A5: m in dom F by A2,Def12;
l in M by A4,A1,XBOOLE_0:def 5;
then m <> LastLoc F by A2,XXREAL_2:def 8;
then not m in {LastLoc F} by TARSKI:def 1;
hence thesis by a3,A4,A5,XBOOLE_0:def 5;
end;
hence thesis;
end;
end;
end;
reserve l for Nat;
theorem
for I being finite initial NAT-defined Function, J being Function
holds dom I misses dom Shift(J,card I)
proof let I be finite initial NAT-defined Function, J be Function;
assume
A1: dom I meets dom Shift(J,card I);
dom Shift(J,card I) = { l+card I: l in dom J } by VALUED_1:def 12;
then consider x being object such that
A2: x in dom I and
A3: x in { l+card I: l in dom J } by A1,XBOOLE_0:3;
consider l such that
A4: x = l+card I and
l in dom J by A3;
thus contradiction by NAT_1:11,A2,A4,Lm1;
end;
:: from SCMPDS_4, 2010.05.14, A.T.
theorem
not m in dom p implies not m+1 in dom p
proof
assume not m in dom p; then
A1: m >= card p by Lm1;
m+1 >= m by NAT_1:11;
hence thesis by Lm1,A1,XXREAL_0:2;
end;
:: from SCM_COMP, 2010.05.16, A.T.
registration let D be set;
cluster D^omega -> functional;
coherence by Def7;
end;
registration let D be set;
cluster -> finite Sequence-like for Element of D^omega;
coherence by Def7;
end;
definition let D be set;
let f be XFinSequence of D;
func Down f -> Element of D^omega equals
f;
coherence by Def7;
end;
definition let D be set;
let f be XFinSequence of D, g be Element of D^omega;
redefine func f^g -> Element of D^omega;
coherence
proof
reconsider g as XFinSequence of D by Def7;
f^g is XFinSequence of D;
hence thesis by Def7;
end;
end;
definition let D be set;
let f, g be Element of D^omega;
redefine func f^g -> Element of D^omega;
coherence
proof
reconsider f,g as XFinSequence of D by Def7;
f^g is XFinSequence of D;
hence thesis by Def7;
end;
end;
:: missing, 2010.05.15, A.T.
theorem Th71:
p c= p^q
proof
A1: dom p c= dom(p^q) by Th19;
for x being object st x in dom p holds (p^q).x = p.x by Def3;
hence thesis by A1,GRFUNC_1:2;
end;
theorem Th72:
len(p^<%x%>) = len p + 1
proof
thus len(p^<%x%>) = len p + len<%x%> by Def3
.= len p + 1 by Th30;
end;
theorem
<%x,y%> = (0,1) --> (x,y)
proof
A1: dom<%x,y%> = len<%x,y%>
.= {0,1} by Th35,CARD_1:50;
A2: <%x,y%>.0 = x;
<%x,y%>.1 = y;
hence <%x,y%> = (0,1) --> (x,y) by A1,A2,FUNCT_4:66;
end;
reserve M for Nat;
theorem Th74:
p^q = p +* Shift(q, card p)
proof
A1: dom Shift(q, card p) = { M+card p:M in dom q } by VALUED_1:def 12;
for x being object
holds x in dom(p^q) iff x in dom p or x in dom Shift(q, card p)
proof let x be object;
thus x in dom(p^q) implies x in dom p or x in dom Shift(q, card p)
proof assume
A2: x in dom(p^q);
then reconsider k = x as Nat;
per cases by A2,Th18;
suppose k in dom p;
hence x in dom p or x in dom Shift(q, card p);
end;
suppose ex n st n in dom q & k=len p + n;
hence x in dom p or x in dom Shift(q, card p) by A1;
end;
end;
assume
A3: x in dom p or x in dom Shift(q, card p);
per cases by A3;
suppose
A4: x in dom p;
dom p c= dom(p^q) by Th19;
hence x in dom(p^q) by A4;
end;
suppose x in dom Shift(q, card p);
then ex M st x = M+card p & M in dom q by A1;
hence x in dom(p^q) by Th21;
end;
end;
then
A5: dom(p^q) = dom p \/ dom Shift(q, card p) by XBOOLE_0:def 3;
for x being object st x in dom p \/ dom Shift(q, card p)
holds (x in dom Shift(q, card p) implies (p^q).x = Shift(q, card p).x) &
(not x in dom Shift(q, card p) implies (p^q).x = p.x)
proof let x be object such that
A6: x in dom p \/ dom Shift(q, card p);
hereby assume
A7: x in dom Shift(q, card p);
then reconsider k = x as Nat;
consider M such that
A8: x = M+card p and
A9: M in dom q by A7,A1;
set m = k -' len p;
A10: len p + m = k by A8,NAT_D:34;
hence (p^q).x = q.m by A8,A9,Def3
.= Shift(q, card p).x by A8,A9,A10,VALUED_1:def 12;
end;
assume not x in dom Shift(q, card p);
then x in dom p by A6,XBOOLE_0:def 3;
hence (p^q).x = p.x by Def3;
end;
hence p^q = p +* Shift(q, card p) by A5,FUNCT_4:def 1;
end;
theorem
p +* (p ^ q) = p ^ q & (p ^ q) +* p = p ^ q by Th71,FUNCT_4:97,98;
reserve m,n for Nat;
theorem Th76:
for I being finite initial NAT-defined Function, J being Function
holds dom Shift(I,n) misses dom Shift(J,n+card I)
proof let I be finite initial NAT-defined Function, J be Function;
assume
A1: dom Shift(I,n) meets dom Shift(J,n+card I);
dom Shift(J,n+card I) = { l+(n+card I): l in dom J } by VALUED_1:def 12;
then consider x being object such that
A2: x in dom Shift(I,n) and
A3: x in { l+(n+card I): l in dom J } by A1,XBOOLE_0:3;
dom Shift(I,n) = { m+n:m in dom I } by VALUED_1:def 12;
then consider m such that
A4: x = m+n and
A5: m in dom I by A2;
consider l such that
A6: x = l+(n+card I) and
l in dom J by A3;
m < card I by A5,Lm1;
hence contradiction by NAT_1:11,A4,A6,XREAL_1:6;
end;
theorem Th77:
Shift(p,n) c= Shift(p^q,n)
proof
p^q = p +* Shift(q, card p) by Th74;
then
A1: Shift(p^q,n) = Shift(p,n) +* Shift(Shift(q,card p),n) by VALUED_1:23;
Shift(Shift(q,card p),n) = Shift(q,n+card p) by VALUED_1:21;
then dom Shift(p,n) misses dom Shift(Shift(q,card p),n) by Th76;
hence Shift(p,n) c= Shift(p^q,n) by A1,FUNCT_4:32;
end;
theorem Th78:
Shift(q,n+card p) c= Shift(p^q,n)
proof
A1: Shift(Shift(q,card p),n) = Shift(q,n+card p) by VALUED_1:21;
p^q = p +* Shift(q, card p) by Th74;
then Shift(p^q,n) = Shift(p,n) +* Shift(Shift(q,card p),n) by VALUED_1:23;
hence thesis by A1,FUNCT_4:25;
end;
theorem
Shift(p^q,n) c= X implies Shift(p,n) c= X
proof assume
A1: Shift(p^q,n) c= X;
Shift(p,n) c= Shift(p^q,n) by Th77;
hence Shift(p,n) c= X by A1;
end;
theorem
Shift(p^q,n) c= X implies Shift(q,n+card p) c= X
proof assume
A1: Shift(p^q,n) c= X;
Shift(q,n+card p) c= Shift(p^q,n) by Th78;
hence thesis by A1;
end;
registration let F be initial non empty NAT-defined finite Function;
cluster CutLastLoc F -> initial;
coherence;
end;
definition let x1,x2,x3,x4 be object;
func <%x1,x2,x3,x4%> -> set equals
<%x1%>^<%x2%>^<%x3%>^<%x4%>;
coherence;
end;
registration let x1,x2,x3,x4 be object;
cluster <%x1,x2,x3,x4%> -> Function-like Relation-like;
coherence;
end;
registration let x1,x2,x3,x4 be object;
cluster <%x1,x2,x3,x4%> -> finite Sequence-like;
coherence;
end;
reserve x1,x2,x3,x4 for object;
theorem
len<%x1,x2,x3,x4%> = 4
proof
thus len<%x1,x2,x3,x4%>
= len<%x1,x2,x3%> + 1 by Th72
.= 3 + 1 by Th36
.= 4;
end;
Lm3:
<%x1,x2,x3,x4%>.1 = x2 &
<%x1,x2,x3,x4%>.2 = x3 &
<%x1,x2,x3,x4%>.3 = x4
proof
A1: len<%x1,x2,x3%> = 3 by Th36;
then
A2: 1 in dom<%x1,x2,x3%> by Lm1;
thus <%x1,x2,x3,x4%>.1
=<%x1,x2,x3%>.1 by A2,Def3
.= x2;
A3: 2 in dom<%x1,x2,x3%> by A1,Lm1;
thus <%x1,x2,x3,x4%>.2
=<%x1,x2,x3%>.2 by A3,Def3
.= x3;
thus <%x1,x2,x3,x4%>.3 = x4 by A1,Th33;
end;
registration
let x1,x2,x3,x4 be object;
reduce <%x1,x2,x3,x4%>.0 to x1;
reducibility
proof
thus <%x1,x2,x3,x4%>.0
=(<%x1%>^<%x2,x3%>^<%x4%>).0 by Th25
.=(<%x1%>^<%x2,x3,x4%>).0 by Th25
.= x1 by Th32;
end;
reduce <%x1,x2,x3,x4%>.1 to x2;
reducibility by Lm3;
reduce <%x1,x2,x3,x4%>.2 to x3;
reducibility by Lm3;
reduce <%x1,x2,x3,x4%>.3 to x4;
reducibility by Lm3;
end;
::$CT
theorem
k < len p iff k in dom p by Lm1;
reserve e,u for object;
theorem
Segm(n+1) --> e = (Segm n --> e)^<%e%>
proof
set p = Segm n --> e, q = Segm(n+1) --> e;
A2: dom q = n+1
.= len p + len <%e%> by Th31;
A3: for k st k in dom p holds q.k=p.k
proof let k;
assume
A4: k in dom p;
p c= q by FUNCT_4:4,NAT_1:63;
hence q.k=p.k by A4,GRFUNC_1:2;
end;
for k st k in dom<%e%> holds q.(len p + k) = <%e%>.k
proof let k such that
A5: k in dom<%e%>;
A6: k = 0 by A5,TARSKI:def 1;
len p < n+1 by NAT_1:13;
then len p + 0 in Segm(n+1) by NAT_1:44;
hence q.(len p + k) = <%e%>.k by A6,FUNCOP_1:7;
end;
hence thesis by A2,A3,Def3;
end;
theorem Th84:
dom Shift(<%e%>,card p) = {card p}
proof
for u holds u in dom Shift(<%e%>,card p) iff u = card p
proof let u;
thus u in dom Shift(<%e%>,card p) implies u = card p
proof
assume u in dom Shift(<%e%>,card p);
then u in { m+card p where m is Nat:m in dom <%e%> } by VALUED_1:def 12;
then consider m being Nat such that
A1: u = m+card p and
A2: m in dom <%e%>;
m = 0 by A2,TARSKI:def 1;
hence u = card p by A1;
end;
0 in 1 by CARD_1:49,TARSKI:def 1;
then 0 in dom <%e%> by Def4;
then 0+card p in dom Shift(<%e%>,card p) by VALUED_1:24;
hence thesis;
end;
hence thesis by TARSKI:def 1;
end;
theorem
dom(p^<%e%>) = dom p \/ {card p}
proof
thus dom(p^<%e%>) = dom(p +* Shift(<%e%>, card p)) by Th74
.= dom p \/ dom Shift(<%e%>,card p) by FUNCT_4:def 1
.= dom p \/ {card p} by Th84;
end;
theorem
<%x%> +~ (x,y) = <%y%>
proof
A1: dom(<%x%> +~ (x,y)) = dom<%x%> by FUNCT_4:99
.= Segm 1 by Th30;
then <%x%> +~ (x,y) is finite by FINSET_1:10;
then reconsider p = <%x%> +~ (x,y) as XFinSequence by A1,ORDINAL1:def 7;
A2: rng<%x%> = {x} by Th30;
then rng p c= {x} \ {x} \/ {y} by FUNCT_4:104;
then rng p c= {} \/ {y} by XBOOLE_1:37;
then
A3: rng p c= {y};
x in rng <%x%> by A2,TARSKI:def 1;
then y in rng p by FUNCT_4:101;
hence <%x%> +~ (x,y) = <%y%> by A1,Th30,A3,ZFMISC_1:33;
end;
theorem
for I being non empty XFinSequence
holds LastLoc I = card I - 1
proof let I be non empty XFinSequence;
A1: card I >= 0+1 by NAT_1:13;
thus LastLoc I = card I -' 1 by Th67
.= card I - 1 by A1,XREAL_1:233;
end;
begin ::: Addenda by Sebastian Koch
:: this holds more basically for any Sequence A, but since
:: the properties of Sequences of the form A ^ <%x%> are not in Mizar yet
:: I have no desire to formally introduce everything of that here, too
theorem
for p being XFinSequence, x being object holds last(p^<%x%>) = x
proof
let p be XFinSequence, x be object;
dom(p^<%x%>) = len(p^<%x%>)
.= len p + 1 by Th72
.= len p +^ 1 by CARD_2:36
.= succ len p by ORDINAL2:31;
hence last(p^<%x%>) = (p^<%x%>).len p by ORDINAL2:6
.= x by Th33;
end;
:: the mirror theorem of BALLOT_1:5, but also for empty D
theorem Th12:
for D being set, p being XFinSequence of D holds FS2XFS (XFS2FS p) = p
proof
let D be set, p be XFinSequence of D;
A1: len p = len XFS2FS p by Def9A;
A2: len XFS2FS p = len FS2XFS (XFS2FS p) by Def8;
for k being Nat st k < len p holds p.k = (FS2XFS (XFS2FS p)).k
proof
let k be Nat;
assume A3: k < len p;
then 0+1 <= k+1 & k+1 < len p +1 by XREAL_1:6;
then A4: 1 <= k+1 & k+1 <= len p by NAT_1:13;
thus p.k = p.(k+1-'1) by NAT_D:34
.= (XFS2FS p).(k+1) by A4, Def9A
.= (FS2XFS (XFS2FS p)).k by A1, A3, Def8;
end;
hence thesis by A1, A2, Th8;
end;
registration
let D be set, f be XFinSequence of D;
reduce FS2XFS XFS2FS f to f;
reducibility by Th12;
end;
theorem Th13:
for D being set, p being FinSequence of D, n being Nat
holds n+1 in dom p iff n in dom FS2XFS p
proof
let D be set, p be FinSequence of D, n be Nat;
hereby
assume n+1 in dom p;
then n+1 <= len p by FINSEQ_3:25;
then n+1-1 < len p-0 by XREAL_1:15;
then n < len FS2XFS p by Def8;
then n in Segm dom FS2XFS p by NAT_1:44;
hence n in dom FS2XFS p;
end;
assume n in dom FS2XFS p;
then n in Segm dom FS2XFS p;
then 0 <= n & n < len FS2XFS p by NAT_1:44;
then 0+1 <= n+1 & n < len p by Def8, XREAL_1:6;
then 1 <= n+1 & n+1 <= len p by NAT_1:13;
hence n+1 in dom p by FINSEQ_3:25;
end;
theorem Th14:
for D being set, p being XFinSequence of D, n being Nat
holds n in dom p iff n+1 in dom XFS2FS p
proof
let D be set, p be XFinSequence of D, n be Nat;
hereby
assume n in dom p;
then n in dom FS2XFS (XFS2FS p);
hence n+1 in dom XFS2FS p by Th13;
end;
assume n+1 in dom XFS2FS p;
then n in dom FS2XFS (XFS2FS p) by Th13;
hence thesis;
end;
registration
let D be set, p be one-to-one FinSequence of D;
cluster FS2XFS p -> one-to-one;
coherence
proof
now
let x1, x2 be object;
assume that
A1: x1 in dom FS2XFS p & x2 in dom FS2XFS p and
A2: (FS2XFS p).x1 = (FS2XFS p).x2;
reconsider n1 = x1, n2 = x2 as Nat by A1;
A3: n1 + 1 in dom p & n2 + 1 in dom p by A1, Th13;
then n1 + 1 <= len p & n2 + 1 <= len p by FINSEQ_3:25;
then A4: n1 < len p & n2 < len p by NAT_1:13;
p.(n1+1) = (FS2XFS p).n1 by A4, Def8
.= p.(n2+1) by A2, A4, Def8;
then n1 + 1 = n2 + 1 by A3, FUNCT_1:def 4;
hence x1 = x2;
end;
hence thesis;
end;
end;
registration
let D be set, p be one-to-one XFinSequence of D;
cluster XFS2FS p -> one-to-one;
coherence
proof
now
let x1, x2 be object;
assume that
A1: x1 in dom XFS2FS p & x2 in dom XFS2FS p and
A2: (XFS2FS p).x1 = (XFS2FS p).x2;
reconsider n1 = x1, n2 = x2 as Nat by A1;
1 <= n1 & n1 <= len XFS2FS p & 1 <= n2 & n2 <= len XFS2FS p
by A1, FINSEQ_3:25;
then A3: 1 <= n1 & n1 <= len p & 1 <= n2 & n2 <= len p by Def9A;
then A4: p.(n1-'1)= (XFS2FS p).n1 & p.(n2-'1)= (XFS2FS p).n2
by Def9A;
A5: n1-'1+1 = n1 & n2-'1+1 = n2 by A3, XREAL_1:235;
then n1-'1 in dom p & n2-'1 in dom p by A1, Th14;
hence x1 = x2 by A2, A4, A5, FUNCT_1:def 4;
end;
hence thesis;
end;
end;
theorem Th15:
for D being set, p being FinSequence of D holds rng p = rng FS2XFS p
proof
let D be set, p be FinSequence of D;
for y being object
holds y in rng FS2XFS p iff ex x being object st x in dom p & p.x = y
proof
let y be object;
thus y in rng FS2XFS p implies ex x being object st x in dom p & p.x = y
proof
assume y in rng FS2XFS p;
then consider n being object such that
A1: n in dom FS2XFS p & (FS2XFS p).n = y by FUNCT_1:def 3;:::AFINSQ_2:3;
reconsider n as Nat by A1;
take n+1;
thus n+1 in dom p by A1, Th13;
n < len FS2XFS p by A1, Lm1;
then n < len p by Def8;
hence p.(n+1) = y by A1, Def8;
end;
given x being object such that
A2: x in dom p & p.x = y;
reconsider n1 = x as Nat by A2;
A3: 1 <= n1 & n1 <= len p by A2, FINSEQ_3:25;
then reconsider n = n1-1 as Nat by Th0;
n < len p - 0 by A3, XREAL_1:15;
then A4: p.(n+1) = (FS2XFS p).n by Def8;
n+1 in dom p by A2;
then n in dom FS2XFS p by Th13;
hence thesis by A2, A4, FUNCT_1:3;
end;
hence thesis by FUNCT_1:def 3;
end;
:: generalizes BALLOT_1:2 to empty D
theorem
for D being set, p being XFinSequence of D holds rng p = rng XFS2FS p
proof
let D be set, p be XFinSequence of D;
thus rng p = rng FS2XFS XFS2FS p
.= rng XFS2FS p by Th15;
end;
registration
let D be set, p be empty XFinSequence of D;
cluster XFS2FS p -> empty;
coherence
proof
len p = {};
then len XFS2FS p = {} by Def9A;
hence thesis;
end;
end;
registration
let D be set, p be empty FinSequence of D;
cluster FS2XFS p -> empty;
coherence
proof
len p = {};
then len FS2XFS p = {} by Def8;
hence thesis;
end;
end;
|