File size: 298,691 Bytes
cdec422 | 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 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 | import Mathlib
namespace OAI
noncomputable section
namespace ZeroKey
section
open scoped MatrixOrder ComplexOrder Kronecker
open Matrix
universe v17_0
theorem exists_isometry_comp_of_norm_eq {V : Type v17_0} [inst17_0 : NormedAddCommGroup V]
[inst17_1 : InnerProductSpace ℂ V] [inst17_2 : FiniteDimensional ℂ V]
(f g : V →ₗ[ℂ] V)
(h : ∀ x, ‖f x‖ = ‖g x‖) :
∃ U : V →ₗᵢ[ℂ] V, U.toLinearMap.comp g = f := by
have hb : ∃ C : ℝ, ∀ x, ‖f x‖ ≤ C * ‖g x‖ := ⟨1, fun x => by simp [h x]⟩
let L : LinearMap.range g →ₗᵢ[ℂ] V :=
{ toLinearMap := (f.compLeftInverse g).toLinearMap
norm_map' := by
rintro ⟨y, x, rfl⟩
simpa only [ContinuousLinearMap.coe_coe,
LinearMap.compLeftInverse_apply_of_bdd f g hb x (g x) rfl,
← Submodule.norm_coe] using h x }
refine ⟨L.extend, ?_⟩
ext x
change L.extend (g x) = f x
rw [show L.extend (g x) = L ⟨g x, LinearMap.mem_range_self g x⟩ from
L.extend_apply ⟨g x, LinearMap.mem_range_self g x⟩]
exact LinearMap.compLeftInverse_apply_of_bdd f g hb x (g x) rfl
universe v43_0
lemma norm_eq_of_gram_eq {ι : Type v43_0} [inst43_0 : Fintype ι] [inst43_1 : DecidableEq ι]
(A B : Matrix ι ι ℂ) (h : Aᴴ * A = Bᴴ * B)
(x : EuclideanSpace ℂ ι) : ‖A.toEuclideanLin x‖ = ‖B.toEuclideanLin x‖ := by
have hh := congrArg (fun M : Matrix ι ι ℂ =>
inner ℂ x (M.toEuclideanLin x)) h
simp only [Matrix.toLpLin_mul_same, Matrix.toEuclideanLin_conjTranspose_eq_adjoint,
LinearMap.comp_apply, LinearMap.adjoint_inner_right] at hh
change inner ℂ (A.toEuclideanLin x) (A.toEuclideanLin x) =
inner ℂ (B.toEuclideanLin x) (B.toEuclideanLin x) at hh
have hh' := congrArg (RCLike.re : ℂ → ℝ) hh
simpa only [inner_self_eq_norm_sq, sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)] using hh'
theorem exists_unitary_mul_of_gram_eq {ι : Type v43_0} [inst43_0 : Fintype ι]
[inst43_1 : DecidableEq ι]
(A B : Matrix ι ι ℂ)
(h : Aᴴ * A = Bᴴ * B) :
∃ U : Matrix.unitaryGroup ι ℂ, A = (U : Matrix ι ι ℂ) * B := by
obtain ⟨U, hU⟩ := exists_isometry_comp_of_norm_eq A.toEuclideanLin B.toEuclideanLin
(norm_eq_of_gram_eq A B h)
let e := U.toLinearIsometryEquiv rfl
let V : Matrix ι ι ℂ := Matrix.toEuclideanLin.symm U.toLinearMap
have hV : V ∈ Matrix.unitaryGroup ι ℂ := by
exact e.toMatrix_mem_unitaryGroup (EuclideanSpace.basisFun ι ℂ)
(EuclideanSpace.basisFun ι ℂ)
refine ⟨⟨V, hV⟩, ?_⟩
apply Matrix.toEuclideanLin.injective
simp only [Matrix.toLpLin_mul_same]
have hVlin : V.toEuclideanLin = U.toLinearMap := by simp [V]
change A.toEuclideanLin = V.toEuclideanLin.comp B.toEuclideanLin
rw [hVlin, hU]
universe v84_0
def traceNorm {ι : Type v84_0} [inst84_0 : Fintype ι] [inst84_1 : DecidableEq ι]
(A : Matrix ι ι ℂ) : ℝ := (Matrix.trace (CFC.sqrt (Aᴴ * A))).re
universe v155_0 v155_1
def matrixVector {ι : Type v155_0} {κ : Type v155_1}
(A : Matrix ι κ ℂ) : EuclideanSpace ℂ (ι × κ) :=
WithLp.toLp 2 (fun x => A x.1 x.2)
abbrev Mat (d : ℕ) := Matrix (Fin d) (Fin d) ℂ
universe v217_0
def matrixUnit {ι : Type v217_0} [DecidableEq ι] (i j : ι) : Matrix ι ι ℂ :=
fun a b => if a = i ∧ b = j then 1 else 0
def amplify {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (k : ℕ)
(U : Matrix (Fin k × Fin a) (Fin k × Fin a) ℂ) :
Matrix (Fin k × Fin b) (Fin k × Fin b) ℂ :=
fun i j => L (fun x y => U (i.1, x) (j.1, y)) i.2 j.2
def CompletelyPositive {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) : Prop :=
∀ k U, U.PosSemidef → (amplify L k U).PosSemidef
def transposeLinear (a : ℕ) : Mat a →ₗ[ℂ] Mat a where
toFun := Matrix.transpose
map_add' := Matrix.transpose_add
map_smul' _ _ := rfl
def PPTType {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) : Prop :=
CompletelyPositive L ∧ CompletelyPositive (L.comp (transposeLinear a))
def tensorMap {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d)
(U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) :
Matrix (Fin b × Fin d) (Fin b × Fin d) ℂ :=
fun i j => ∑ x, ∑ y, ∑ z, ∑ w,
U (x,z) (y,w) * L (matrixUnit x y) i.1 j.1 * M (matrixUnit z w) i.2 j.2
universe v243_0
def outer {ι : Type v243_0} (u v : ι → ℂ) : Matrix ι ι ℂ :=
fun i j => u i * star (v j)
universe v246_0
def Density {ι : Type v246_0} [Fintype ι] (R : Matrix ι ι ℂ) : Prop :=
R.PosSemidef ∧ Matrix.trace R = 1
universe v264_0
def amplifyIndex {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) {κ : Type v264_0}
(U : Matrix (κ × Fin a) (κ × Fin a) ℂ) :
Matrix (κ × Fin b) (κ × Fin b) ℂ :=
fun i j => L (fun x y => U (i.1,x) (j.1,y)) i.2 j.2
universe v269_0
lemma cp_amplifyIndex {a b : ℕ} {L : Mat a →ₗ[ℂ] Mat b} (hL : CompletelyPositive L)
{κ : Type v269_0} [Fintype κ] (U : Matrix (κ × Fin a) (κ × Fin a) ℂ)
(hU : U.PosSemidef) : (amplifyIndex L U).PosSemidef := by
let e := Fintype.equivFin κ
have h := hL (Fintype.card κ)
(U.submatrix (fun i => (e.symm i.1, i.2)) (fun i => (e.symm i.1, i.2)))
(hU.submatrix _)
have h' := h.submatrix (fun i : κ × Fin b => (e i.1, i.2))
convert h' using 1
ext i j
simp [amplifyIndex, amplify, Matrix.submatrix]
lemma matrix_sum_units {a : ℕ} (U : Mat a) :
U = ∑ x, ∑ y, U x y • matrixUnit x y := by
ext i j
simp [matrixUnit, Matrix.sum_apply, Matrix.smul_apply, ite_and]
lemma linearMap_matrix_units {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (U : Mat a) :
L U = ∑ x, ∑ y, U x y • L (matrixUnit x y) := by
conv_lhs => rw [matrix_sum_units U]
simp
lemma linearMap_matrix_units_apply {a b : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (U : Mat a)
(i j : Fin b) : L U i j = ∑ x, ∑ y, U x y * L (matrixUnit x y) i j := by
have h := congrArg (fun A : Mat b => A i j) (linearMap_matrix_units L U)
simpa only [Matrix.sum_apply, Matrix.smul_apply, smul_eq_mul] using h
lemma tensorMap_apply {a b c d : ℕ} (L : Mat a →ₗ[ℂ] Mat b) (M : Mat c →ₗ[ℂ] Mat d)
(U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ) (i j : Fin b) (k l : Fin d) :
tensorMap L M U (i,k) (j,l) =
L (fun x y => M (fun z w => U (x,z) (y,w)) k l) i j := by
calc
_ = ∑ x, ∑ y, (∑ z, ∑ w, U (x,z) (y,w) * M (matrixUnit z w) k l) *
L (matrixUnit x y) i j := by
simp only [tensorMap, Finset.sum_mul]
apply Finset.sum_congr rfl
intro x _
apply Finset.sum_congr rfl
intro y _
apply Finset.sum_congr rfl
intro z _
apply Finset.sum_congr rfl
intro w _
ring
_ = ∑ x, ∑ y, M (fun z w => U (x,z) (y,w)) k l * L (matrixUnit x y) i j := by
apply Finset.sum_congr rfl
intro x _
apply Finset.sum_congr rfl
intro y _
exact congrArg (fun t => t * L (matrixUnit x y) i j)
(linearMap_matrix_units_apply M (fun z w => U (x,z) (y,w)) k l).symm
_ = _ := (linearMap_matrix_units_apply L _ i j).symm
lemma tensorMap_positive {a b c d : ℕ} {L : Mat a →ₗ[ℂ] Mat b}
{M : Mat c →ₗ[ℂ] Mat d} (hL : CompletelyPositive L) (hM : CompletelyPositive M)
{U : Matrix (Fin a × Fin c) (Fin a × Fin c) ℂ} (hU : U.PosSemidef) :
(tensorMap L M U).PosSemidef := by
have h₁ := cp_amplifyIndex hM U hU
have h₂ := cp_amplifyIndex hL _ (h₁.submatrix Prod.swap)
have h₃ := h₂.submatrix Prod.swap
convert h₃ using 1
ext i j
exact tensorMap_apply L M U i.1 j.1 i.2 j.2
universe v375_0
lemma outer_posSemidef {ι : Type v375_0} [Fintype ι] (u : ι → ℂ) : (outer u u).PosSemidef := by
exact Matrix.posSemidef_vecMulVec_self_star u
universe v1019_0
lemma cp_of_kraus_representation {a b : ℕ} {ν : Type v1019_0} [Fintype ν]
(L : Mat a →ₗ[ℂ] Mat b) (K : ν → Matrix (Fin b) (Fin a) ℂ)
(hK : ∀ U, L U = ∑ s, K s * U * (K s)ᴴ) : CompletelyPositive L := by
intro r U hU
have he : amplify L r U = ∑ s, ((1 : Mat r) ⊗ₖ K s) * U * ((1 : Mat r) ⊗ₖ K s)ᴴ := by
ext ⟨i,x⟩ ⟨j,y⟩
change L (fun v w => U (i,v) (j,w)) x y = _
erw [hK]
simp only [Matrix.sum_apply]
apply Finset.sum_congr rfl
intro s _
change (K s * U.submatrix (fun v => (i,v)) (fun w => (j,w)) * (K s)ᴴ) x y = _
simp [Matrix.mul_apply, Matrix.conjTranspose_apply, Matrix.submatrix,
Fintype.sum_prod_type, Matrix.one_apply, apply_ite]
rw [he]
apply Matrix.posSemidef_sum
intro s _
exact hU.mul_mul_conjTranspose_same _
end
open Matrix
open scoped MatrixOrder ComplexOrder Kronecker
section
universe v1102_0 v1102_1
variable {σ : Type v1102_0} {ι : σ → Type v1102_1} [inst1102_0 : Fintype σ] [inst1102_1 : DecidableEq σ]
[inst1102_2 : ∀ s, Fintype (ι s)] [inst1102_3 : ∀ s, DecidableEq (ι s)]
def tensorPi (A : ∀ s, Matrix (ι s) (ι s) ℂ) : Matrix (∀ s, ι s) (∀ s, ι s) ℂ :=
fun i j => ∏ s, A s (i s) (j s)
omit inst1102_3 in
lemma tensorPi_mul [∀ s, DecidableEq (ι s)] (A B : ∀ s, Matrix (ι s) (ι s) ℂ) :
tensorPi (fun s => A s * B s) = tensorPi A * tensorPi B := by
ext i j
simp only [tensorPi, Matrix.mul_apply]
rw [Fintype.prod_sum]
apply Finset.sum_congr rfl
intro k _
exact Finset.prod_mul_distrib
omit inst1102_1 inst1102_2 in
lemma tensorPi_one [DecidableEq σ] [∀ s, Fintype (ι s)] : tensorPi (fun s => (1 : Matrix (ι s) (ι s) ℂ)) = 1 := by
ext i j
by_cases h : i=j
· subst j
simp [tensorPi]
· obtain ⟨s,hs⟩ := Function.ne_iff.mp h
simp only [tensorPi, Matrix.one_apply, ite_eq_right h]
apply Finset.prod_eq_zero (Finset.mem_univ s)
simp [hs]
omit inst1102_1 inst1102_2 inst1102_3 in
lemma tensorPi_star [DecidableEq σ] [∀ s, Fintype (ι s)] [∀ s, DecidableEq (ι s)] (A : ∀ s, Matrix (ι s) (ι s) ℂ) :
tensorPi (fun s => (A s)ᴴ) = (tensorPi A)ᴴ := by
ext i j
simp [tensorPi, Matrix.conjTranspose_apply]
lemma tensorPi_projection (A : ∀ s, Matrix (ι s) (ι s) ℂ)
(hA : ∀ s, IsStarProjection (A s)) : IsStarProjection (tensorPi A) := by
constructor
· change tensorPi A * tensorPi A = tensorPi A
rw [← tensorPi_mul]
congr 1
funext s
exact (hA s).isIdempotentElem
· change (tensorPi A)ᴴ = tensorPi A
rw [← tensorPi_star]
congr 1
funext s
exact (hA s).isSelfAdjoint
universe v1163_0
omit inst1102_2 inst1102_3 in
lemma tensorPi_sum [∀ s, Fintype (ι s)] [∀ s, DecidableEq (ι s)] {α : σ → Type v1163_0} [∀ s, Fintype (α s)]
(A : ∀ s, α s → Matrix (ι s) (ι s) ℂ) :
(∑ a : ∀ s, α s, tensorPi (fun s => A s (a s))) =
tensorPi (fun s => ∑ a, A s a) := by
ext i j
simp only [Matrix.sum_apply, tensorPi]
exact (Fintype.prod_sum (fun s a => A s a (i s) (j s))).symm
end
namespace Explicit
section
abbrev p : ℕ := 257
abbrev k : ℕ := 1028
@[irreducible] def b : ℕ := Nat.choose 1027 513
@[irreducible] def Q : ℕ := b^3
@[irreducible] def K : ℕ := k^3
def dimensionFunction (q : ℕ) : ℕ := 4^(Nat.choose q 8)
lemma dimensionFunction_eq (q : ℕ) : dimensionFunction q = 4^(Nat.choose q 8) := rfl
@[irreducible] def D : ℕ := dimensionFunction Q
lemma D_eq : D = 4^(Nat.choose Q 8) := by
unfold D
exact dimensionFunction_eq Q
def outputDimensionFunction (q d : ℕ) : ℕ := q*d
lemma outputDimensionFunction_eq (q d : ℕ) : outputDimensionFunction q d = q*d := rfl
@[irreducible] def m : ℕ := outputDimensionFunction Q D
lemma m_eq : m = Q*D := by
unfold m
exact outputDimensionFunction_eq Q D
def Base := {A : Finset (Fin k) // A.card = 514 ∧ (0 : Fin k) ∈ A}
instance : Finite Base := by unfold Base; infer_instance
instance : Fintype Base := Fintype.ofFinite _
instance : DecidableEq Base := Classical.decEq _
instance : LinearOrder Base := LinearOrder.lift' (fun A : Base => A.1.sort (· ≤ ·)) (by
intro A B h
apply Subtype.ext
simpa only [Finset.sort_toFinset] using congrArg List.toFinset h)
def Question := Lex (Fin 3 → Base)
instance : Finite Question := by unfold Question; infer_instance
instance : Fintype Question := Fintype.ofFinite _
instance : DecidableEq Question := Classical.decEq _
instance : LinearOrder Question := inferInstanceAs (LinearOrder (Lex (Fin 3 → Base)))
def baseVector (A : Base) (h : Fin k) : ℝ :=
(if h ∈ A.1 then 1 else -1) / Real.sqrt k
def vector (q : Question) (h : Fin 3 → Fin k) : ℝ :=
∏ l, baseVector (ofLex q l) (h l)
def overlap (q r : Question) : ℝ := ∑ h, vector q h * vector r h
def EightSet := {S : Finset Question // S.card = 8}
instance : Finite EightSet := by unfold EightSet; infer_instance
instance : Fintype EightSet := Fintype.ofFinite _
instance : DecidableEq EightSet := Classical.decEq _
instance : LinearOrder EightSet := LinearOrder.lift'
(fun S : EightSet => S.1.sort (· ≤ ·)) (by
intro S T h
apply Subtype.ext
simpa only [Finset.sort_toFinset] using congrArg List.toFinset h)
def PairwiseOrthogonal (S : EightSet) : Prop :=
∀ q ∈ S.1, ∀ r ∈ S.1, q ≠ r → overlap q r = 0
abbrev Sign := Fin 2
def signValue (s : Sign) : ℂ := if s=0 then -1 else 1
abbrev Outcome := Lex (Sign × Sign)
abbrev LocalBasis := Lex (Fin 2 × Fin 2)
def pauliX : Matrix (Fin 2) (Fin 2) ℂ := !![0,1;1,0]
def pauliY : Matrix (Fin 2) (Fin 2) ℂ := !![0,-Complex.I;Complex.I,0]
def pauliZ : Matrix (Fin 2) (Fin 2) ℂ := !![1,0;0,-1]
def tensor₂ (A B : Matrix (Fin 2) (Fin 2) ℂ) : Matrix LocalBasis LocalBasis ℂ :=
(A ⊗ₖ B).submatrix ofLex ofLex
def observable : Fin 3 → Fin 3 → Matrix LocalBasis LocalBasis ℂ
| 0,0 => tensor₂ pauliX 1
| 0,1 => tensor₂ 1 pauliX
| 0,2 => tensor₂ pauliX pauliX
| 1,0 => tensor₂ 1 pauliZ
| 1,1 => tensor₂ pauliZ 1
| 1,2 => tensor₂ pauliZ pauliZ
| 2,0 => tensor₂ pauliX pauliZ
| 2,1 => tensor₂ pauliZ pauliX
| 2,2 => tensor₂ pauliY pauliY
def contextObservable (t : Fin 6) (j : Fin 3) : Matrix LocalBasis LocalBasis ℂ :=
if h : t.val < 3 then observable ⟨t.val,h⟩ j
else observable j ⟨t.val-3, by omega⟩
def contextProjection (t : Fin 6) (a : Outcome) : Matrix LocalBasis LocalBasis ℂ :=
(1/4 : ℂ) • ((1+signValue (ofLex a).1 • contextObservable t 0) *
(1+signValue (ofLex a).2 • contextObservable t 1))
def trivialProjection (a : Outcome) : Matrix LocalBasis LocalBasis ℂ :=
if ofLex a = (1,1) then 1 else 0
def localProjection (S : EightSet) (q : Question) (a : Outcome) :
Matrix LocalBasis LocalBasis ℂ :=
by
classical
exact
if PairwiseOrthogonal S then
if h : q ∈ S.1 then
let rank := (S.1.orderIsoOfFin S.2).symm ⟨q,h⟩
if hr : rank.val < 6 then contextProjection ⟨rank.val,hr⟩ a
else trivialProjection a
else trivialProjection a
else trivialProjection a
def Basis := Lex (EightSet → LocalBasis)
instance : Finite Basis := by unfold Basis; infer_instance
instance : Fintype Basis := Fintype.ofFinite _
instance : DecidableEq Basis := Classical.decEq _
instance : LinearOrder Basis := inferInstanceAs (LinearOrder (Lex (EightSet → LocalBasis)))
def OutcomeString := Lex (EightSet → Outcome)
instance : Finite OutcomeString := by unfold OutcomeString; infer_instance
instance : Fintype OutcomeString := Fintype.ofFinite _
instance : DecidableEq OutcomeString := Classical.decEq _
instance : LinearOrder OutcomeString := inferInstanceAs (LinearOrder (Lex (EightSet → Outcome)))
def Label := Lex (Question × OutcomeString)
instance : Finite Label := by unfold Label; infer_instance
instance : Fintype Label := Fintype.ofFinite _
instance : DecidableEq Label := Classical.decEq _
instance : LinearOrder Label := inferInstanceAs (LinearOrder (Lex (Question × OutcomeString)))
def projection (i : Label) : Matrix Basis Basis ℂ := fun h l =>
∏ S, localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) (ofLex h S) (ofLex l S)
def block (i j : Label) : Matrix Basis Basis ℂ :=
(overlap (ofLex i).1 (ofLex j).1 : ℂ) • (projection i * projection j)
universe v1312_0 v1312_1
def traceBlockMap {α : Type v1312_0} {β : Type v1312_1} [Fintype α] [DecidableEq α]
(H : β → β → Matrix α α ℂ) : Matrix α α ℂ →ₗ[ℂ] Matrix β β ℂ where
toFun U i j := trace (H i j * U)
map_add' U V := by
ext i j
change trace (H i j * (U+V)) = trace (H i j * U)+trace (H i j * V)
rw [mul_add, Matrix.trace_add]
map_smul' c U := by
ext i j
change trace (H i j * (c • U)) = c * trace (H i j * U)
rw [Matrix.mul_smul, Matrix.trace_smul]
rfl
def rawOutput : Matrix (Label × Label) (Label × Label) ℂ := fun i j =>
∑ h, ∑ l, block i.1 j.1 l h * block i.2 j.2 l h
def rho : Matrix (Label × Label) (Label × Label) ℂ :=
((Q^2*D : ℕ) : ℂ)⁻¹ • rawOutput
lemma tensor₂_apply (A B : Matrix (Fin 2) (Fin 2) ℂ) (i j : LocalBasis) :
tensor₂ A B i j = A (ofLex i).1 (ofLex j).1 * B (ofLex i).2 (ofLex j).2 := rfl
lemma sum_localBasis (f : LocalBasis → ℂ) : (∑ i, f i) =
f (toLex (0,0)) + f (toLex (0,1)) + (f (toLex (1,0)) + f (toLex (1,1))) := by
change (∑ i : Fin 2 × Fin 2, f (toLex i)) = _
rw [Fintype.sum_prod_type, Fin.sum_univ_two, Fin.sum_univ_two, Fin.sum_univ_two]
lemma signValue_sq (a : Sign) : signValue a * signValue a = 1 := by
fin_cases a <;> norm_num [signValue]
lemma signValue_conj (a : Sign) : star (signValue a) = signValue a := by
fin_cases a <;> norm_num [signValue]
lemma localBasis_one_apply (i j : LocalBasis) :
(1 : Matrix LocalBasis LocalBasis ℂ) i j = if ofLex i = ofLex j then 1 else 0 := by
simp only [Matrix.one_apply, ofLex.injective.eq_iff]
lemma context_hermitian (t : Fin 6) (j : Fin 3) :
(contextObservable t j).IsHermitian := by
fin_cases t <;> fin_cases j <;> change (tensor₂ _ _).IsHermitian
all_goals
rw [Matrix.IsHermitian]
ext i l
rw [Matrix.conjTranspose_apply, tensor₂_apply, tensor₂_apply]
generalize hi : ofLex i = ii
generalize hl : ofLex l = ll
rcases ii with ⟨i,h⟩
rcases ll with ⟨l,k⟩
fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;>
norm_num [pauliX, pauliY, pauliZ, Matrix.one_apply]
lemma context_real (t : Fin 6) (j : Fin 3) (i l : LocalBasis) :
star (contextObservable t j i l) = contextObservable t j i l := by
fin_cases t <;> fin_cases j <;> change star (tensor₂ _ _ i l) = tensor₂ _ _ i l
all_goals
rw [tensor₂_apply]
generalize hi : ofLex i = ii
generalize hl : ofLex l = ll
rcases ii with ⟨i,h⟩
rcases ll with ⟨l,k⟩
fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;>
norm_num [pauliX, pauliY, pauliZ, Matrix.one_apply]
lemma context_involution (t : Fin 6) (j : Fin 3) :
contextObservable t j * contextObservable t j = 1 := by
fin_cases t <;> fin_cases j <;> change tensor₂ _ _ * tensor₂ _ _ = (1 : Matrix LocalBasis LocalBasis ℂ)
all_goals
ext i l
rw [Matrix.mul_apply, sum_localBasis, localBasis_one_apply]
simp only [tensor₂_apply, ofLex_toLex]
generalize hi : ofLex i = ii
generalize hl : ofLex l = ll
rcases ii with ⟨i,h⟩
rcases ll with ⟨l,k⟩
fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;>
norm_num [pauliX, pauliY, pauliZ, Matrix.one_apply]
lemma context_commute (t : Fin 6) :
Commute (contextObservable t 0) (contextObservable t 1) := by
change contextObservable t 0 * contextObservable t 1 = contextObservable t 1 * contextObservable t 0
fin_cases t <;> change tensor₂ _ _ * tensor₂ _ _ = tensor₂ _ _ * tensor₂ _ _
all_goals
ext i l
simp only [Matrix.mul_apply, sum_localBasis, tensor₂_apply, ofLex_toLex]
generalize hi : ofLex i = ii
generalize hl : ofLex l = ll
rcases ii with ⟨i,h⟩
rcases ll with ⟨l,k⟩
fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;>
norm_num [pauliX, pauliY, pauliZ, Matrix.one_apply]
def contextParity (t : Fin 6) : ℂ := if t=5 then -1 else 1
lemma context_third (t : Fin 6) : contextObservable t 2 =
contextParity t • (contextObservable t 0 * contextObservable t 1) := by
fin_cases t <;> change tensor₂ _ _ = _ • (tensor₂ _ _ * tensor₂ _ _)
all_goals
ext i l
simp only [Matrix.smul_apply, smul_eq_mul, Matrix.mul_apply, sum_localBasis, tensor₂_apply, ofLex_toLex]
generalize hi : ofLex i = ii
generalize hl : ofLex l = ll
rcases ii with ⟨i,h⟩
rcases ll with ⟨l,k⟩
fin_cases i <;> fin_cases h <;> fin_cases l <;> fin_cases k <;>
norm_num [contextParity, pauliX, pauliY, pauliZ, Matrix.one_apply, Fin.ext_iff]
def spectralSign (O : Matrix LocalBasis LocalBasis ℂ) (a : Sign) :=
(1/2 : ℂ) • (1 + signValue a • O)
lemma sign_eigen_aux (O : Matrix LocalBasis LocalBasis ℂ) (hO : O*O=1) (a : Sign) :
O*(1+signValue a • O) = signValue a • (1+signValue a • O) := by
simp only [mul_add, mul_one, mul_smul_comm, hO, smul_add, smul_smul,
signValue_sq, one_smul]
exact add_comm _ _
lemma spectralSign_projection (O : Matrix LocalBasis LocalBasis ℂ)
(hO : O.IsHermitian) (hO2 : O*O=1) (a : Sign) :
IsStarProjection (spectralSign O a) := by
refine ⟨?_, ?_⟩
· change spectralSign O a * spectralSign O a = spectralSign O a
dsimp [spectralSign]
rw [smul_mul_smul_comm, add_mul, one_mul, smul_mul_assoc, sign_eigen_aux O hO2]
rw [smul_smul, signValue_sq, one_smul]
module
· change star (spectralSign O a) = spectralSign O a
dsimp [spectralSign]
simp only [star_smul, star_add, star_one, signValue_conj, hO.star_eq]
norm_num
lemma spectralSign_commute (O T : Matrix LocalBasis LocalBasis ℂ)
(h : Commute O T) (a b : Sign) : Commute (spectralSign O a) (spectralSign T b) := by
unfold spectralSign
exact ((Commute.one_left _).add_left ((Commute.one_right _).add_right
(h.smul_left _ |>.smul_right _))).smul_left _ |>.smul_right _
lemma contextProjection_factor (t : Fin 6) (a : Outcome) : contextProjection t a =
spectralSign (contextObservable t 0) (ofLex a).1 *
spectralSign (contextObservable t 1) (ofLex a).2 := by
simp only [contextProjection, spectralSign, smul_mul_smul_comm]
norm_num
lemma contextProjection_projection (t : Fin 6) (a : Outcome) :
IsStarProjection (contextProjection t a) := by
rw [contextProjection_factor]
exact (spectralSign_projection _ (context_hermitian t 0) (context_involution t 0) _).mul
(spectralSign_projection _ (context_hermitian t 1) (context_involution t 1) _)
(spectralSign_commute _ _ (context_commute t) _ _)
lemma contextProjection_real (t : Fin 6) (a : Outcome) (i j : LocalBasis) :
star (contextProjection t a i j) = contextProjection t a i j := by
simp only [contextProjection, Matrix.smul_apply, smul_eq_mul, Matrix.mul_apply,
star_mul, star_sum, Matrix.add_apply, Matrix.smul_apply, smul_eq_mul,
star_add, context_real, signValue_conj]
simp [Matrix.one_apply, mul_comm]
lemma contextParity_conj (t : Fin 6) : star (contextParity t) = contextParity t := by
unfold contextParity
split <;> norm_num
def contextEigenvalue (t : Fin 6) (a : Outcome) : Fin 3 → ℂ :=
![signValue (ofLex a).1, signValue (ofLex a).2,
contextParity t * signValue (ofLex a).1 * signValue (ofLex a).2]
lemma context_eigen_first (t : Fin 6) (a : Outcome) :
contextObservable t 0 * contextProjection t a =
signValue (ofLex a).1 • contextProjection t a := by
unfold contextProjection
rw [mul_smul_comm, ← mul_assoc, sign_eigen_aux _ (context_involution t 0),
smul_mul_assoc, smul_comm]
lemma context_eigen_second (t : Fin 6) (a : Outcome) :
contextObservable t 1 * contextProjection t a =
signValue (ofLex a).2 • contextProjection t a := by
unfold contextProjection
rw [mul_smul_comm]
have hc : Commute (contextObservable t 1)
(1+signValue (ofLex a).1 • contextObservable t 0) :=
(Commute.one_right _).add_right ((context_commute t).symm.smul_right _)
rw [← mul_assoc, hc, mul_assoc, sign_eigen_aux _ (context_involution t 1),
mul_smul_comm, smul_comm]
lemma context_eigen (t : Fin 6) (a : Outcome) (j : Fin 3) :
contextObservable t j * contextProjection t a =
contextEigenvalue t a j • contextProjection t a := by
fin_cases j
· exact context_eigen_first t a
· exact context_eigen_second t a
· change contextObservable t 2 * contextProjection t a =
(contextParity t * signValue (ofLex a).1 * signValue (ofLex a).2) • _
rw [context_third, smul_mul_assoc, mul_assoc, context_eigen_second,
mul_smul_comm, context_eigen_first]
simp only [smul_smul]
congr 1
ring
lemma contextEigenvalue_conj (t : Fin 6) (a : Outcome) (j : Fin 3) :
star (contextEigenvalue t a j) = contextEigenvalue t a j := by
(fin_cases j <;> simp [contextEigenvalue, star_mul, signValue_conj, contextParity_conj]); ring
lemma context_eigen_right (t : Fin 6) (a : Outcome) (j : Fin 3) :
contextProjection t a * contextObservable t j =
contextEigenvalue t a j • contextProjection t a := by
have h := congrArg star (context_eigen t a j)
simpa only [star_mul, (contextProjection_projection t a).isSelfAdjoint.star_eq,
(context_hermitian t j).star_eq, star_smul, contextEigenvalue_conj] using h
lemma spectralSign_sum (O : Matrix LocalBasis LocalBasis ℂ) :
∑ a, spectralSign O a = 1 := by
rw [Fin.sum_univ_two]
norm_num [spectralSign, signValue]
module
lemma contextProjection_sum (t : Fin 6) : ∑ a, contextProjection t a = 1 := by
simp_rw [contextProjection_factor]
change (∑ a : Sign × Sign, spectralSign (contextObservable t 0) a.1 *
spectralSign (contextObservable t 1) a.2) = _
rw [Fintype.sum_prod_type]
simp only [← Finset.mul_sum, ← Finset.sum_mul, spectralSign_sum, one_mul]
universe v1552_0
lemma eigenvalues_agree {ι : Type v1552_0} [Fintype ι] (E F O : Matrix ι ι ℂ)
(a b : ℂ) (hE : E*O=a • E) (hF : O*F=b • F) (hEF : E*F≠0) : a=b := by
apply smul_left_injective ℂ hEF
calc a • (E*F) = (E*O)*F := by rw [hE, smul_mul_assoc]
_ = E*(O*F) := mul_assoc _ _ _
_ = b • (E*F) := by rw [hF, mul_smul_comm]
lemma signValue_injective : Function.Injective signValue := by
intro a b hab
fin_cases a <;> fin_cases b <;> first | rfl | norm_num [signValue] at hab
lemma contextProjection_orthogonal (t : Fin 6) (a b : Outcome) (hab : a≠b) :
contextProjection t a * contextProjection t b = 0 := by
by_contra h
have he (j : Fin 3) := eigenvalues_agree _ _ _ _ _
(context_eigen_right t a j) (context_eigen t b j) h
apply hab
apply ofLex.injective
apply Prod.ext
· exact signValue_injective (he 0)
· exact signValue_injective (he 1)
lemma trivialProjection_projection (a : Outcome) : IsStarProjection (trivialProjection a) := by
unfold trivialProjection
split <;> simp only [IsStarProjection.one, IsStarProjection.zero]
lemma trivialProjection_sum : ∑ a, trivialProjection a = 1 := by
classical
have h : ∀ a, trivialProjection a = if a = toLex (1,1) then 1 else 0 := by
intro a
simp [trivialProjection, ← ofLex.injective.eq_iff]
simp only [h]
simp
lemma trivialProjection_orthogonal (a b : Outcome) (hab : a≠b) :
trivialProjection a * trivialProjection b = 0 := by
by_cases ha : ofLex a = (1,1)
· have hb : ofLex b ≠ (1,1) := fun hb => hab (ofLex.injective (ha.trans hb.symm))
simp [trivialProjection, hb]
· simp [trivialProjection, ha]
lemma localProjection_type (S : EightSet) (q : Question) :
(localProjection S q = trivialProjection) ∨
(∃ t : Fin 6, localProjection S q = contextProjection t) := by
classical
unfold localProjection
split
· split
· dsimp only
split
· exact Or.inr ⟨_,rfl⟩
· exact Or.inl rfl
· exact Or.inl rfl
· exact Or.inl rfl
lemma localProjection_projection (S : EightSet) (q : Question) (a : Outcome) :
IsStarProjection (localProjection S q a) := by
rcases localProjection_type S q with h | ⟨t,h⟩
· rw [h]; exact trivialProjection_projection a
· rw [h]; exact contextProjection_projection t a
lemma localProjection_real (S : EightSet) (q : Question) (a : Outcome) (i j : LocalBasis) :
star (localProjection S q a i j) = localProjection S q a i j := by
rcases localProjection_type S q with h | ⟨t,h⟩
· rw [h]
unfold trivialProjection
split <;> simp [Matrix.one_apply]
· rw [h]; exact contextProjection_real t a i j
lemma localProjection_sum (S : EightSet) (q : Question) :
∑ a, localProjection S q a = 1 := by
rcases localProjection_type S q with h | ⟨t,h⟩
· rw [h]; exact trivialProjection_sum
· rw [h]; exact contextProjection_sum t
lemma localProjection_orthogonal (S : EightSet) (q : Question) (a b : Outcome) (hab : a≠b) :
localProjection S q a * localProjection S q b = 0 := by
rcases localProjection_type S q with h | ⟨t,h⟩
· rw [h]; exact trivialProjection_orthogonal a b hab
· rw [h]; exact contextProjection_orthogonal t a b hab
lemma projection_tensor (i : Label) : projection i =
(tensorPi (fun S => localProjection S (ofLex i).1 (ofLex (ofLex i).2 S))).submatrix
(show Basis ≃ (EightSet → LocalBasis) from Equiv.refl _) (show Basis ≃ (EightSet → LocalBasis) from Equiv.refl _) := rfl
lemma projection_projection (i : Label) : IsStarProjection (projection i) := by
let e : Basis ≃ (EightSet → LocalBasis) := Equiv.refl _
let A := tensorPi (fun S => localProjection S (ofLex i).1 (ofLex (ofLex i).2 S))
have hA : IsStarProjection A := tensorPi_projection _ (fun S => localProjection_projection _ _ _)
rw [projection_tensor]
change IsStarProjection (A.submatrix e e)
constructor
· change A.submatrix e e * A.submatrix e e = A.submatrix e e
rw [Matrix.submatrix_mul_equiv, hA.isIdempotentElem]
· change (A.submatrix e e)ᴴ = A.submatrix e e
rw [Matrix.conjTranspose_submatrix, show Aᴴ=A from hA.isSelfAdjoint]
lemma projection_real (i : Label) (h l : Basis) : star (projection i h l) = projection i h l := by
change (starRingEnd ℂ) (∏ S, localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) (ofLex h S) (ofLex l S)) = _
rw [map_prod]
simp only [starRingEnd_apply, localProjection_real]
rfl
lemma projection_sum (q : Question) : ∑ a : OutcomeString, projection (toLex (q,a)) = 1 := by
ext h l
simp only [Matrix.sum_apply, projection, ofLex_toLex]
have he := congr_fun (congr_fun (tensorPi_sum (fun S a => localProjection S q a)) (ofLex h)) (ofLex l)
have hr : tensorPi (fun S => ∑ a, localProjection S q a) = 1 := by
simp only [localProjection_sum, tensorPi_one]
rw [hr] at he
calc
_ = ∑ a : EightSet → Outcome, ∏ S, localProjection S q (a S) (ofLex h S) (ofLex l S) :=
(Equiv.sum_comp (show (EightSet → Outcome) ≃ OutcomeString from Equiv.refl _)
(fun a : OutcomeString => ∏ S, localProjection S q (ofLex a S) (ofLex h S) (ofLex l S))).symm
_ = _ := by
simpa only [tensorPi, Matrix.sum_apply, Matrix.one_apply,
show (ofLex h = ofLex l) ↔ h=l from Iff.rfl] using he
lemma projection_mul_apply (i j : Label) (h l : Basis) :
(projection i * projection j) h l = ∏ S,
(localProjection S (ofLex i).1 (ofLex (ofLex i).2 S) *
localProjection S (ofLex j).1 (ofLex (ofLex j).2 S)) (ofLex h S) (ofLex l S) := by
let e : Basis ≃ (EightSet → LocalBasis) := Equiv.refl _
let A := tensorPi (fun S => localProjection S (ofLex i).1 (ofLex (ofLex i).2 S))
let B := tensorPi (fun S => localProjection S (ofLex j).1 (ofLex (ofLex j).2 S))
change (A.submatrix e e * B.submatrix e e) h l = _
rw [Matrix.submatrix_mul_equiv]
exact congr_fun (congr_fun (tensorPi_mul _ _).symm (ofLex h)) (ofLex l)
lemma trivialProjection_commute (a : Outcome) (A : Matrix LocalBasis LocalBasis ℂ) :
Commute (trivialProjection a) A := by
unfold trivialProjection
split <;> simp
lemma localProjection_self_commute (S : EightSet) (q : Question) (a b : Outcome) :
Commute (localProjection S q a) (localProjection S q b) := by
by_cases h : a=b
· subst b; exact Commute.refl _
· change _ * _ = _ * _
rw [localProjection_orthogonal _ _ _ _ h,
localProjection_orthogonal _ _ _ _ (Ne.symm h)]
lemma localProjection_trivial_of_not_orthogonal (S : EightSet) (q : Question)
(h : ¬PairwiseOrthogonal S) : localProjection S q = trivialProjection := by
funext a
simp only [localProjection, ite_eq_right h]
lemma localProjection_trivial_of_not_mem (S : EightSet) (q : Question)
(h : q∉S.1) : localProjection S q = trivialProjection := by
funext a
simp only [localProjection, dite_eq_right h, ite_self]
lemma localProjection_commute (S : EightSet) (q r : Question) (a b : Outcome)
(hqr : overlap q r ≠ 0) : Commute (localProjection S q a) (localProjection S r b) := by
by_cases he : q=r
· subst r; exact localProjection_self_commute S q a b
by_cases hS : PairwiseOrthogonal S
· by_cases hq : q∈S.1
· have hr : r∉S.1 := fun hr => hqr (hS q hq r hr he)
rw [localProjection_trivial_of_not_mem S r hr]
exact (trivialProjection_commute b _).symm
· rw [localProjection_trivial_of_not_mem S q hq]
exact trivialProjection_commute a _
· rw [localProjection_trivial_of_not_orthogonal S q hS]
exact trivialProjection_commute a _
lemma projection_commute (i j : Label) (hij : overlap (ofLex i).1 (ofLex j).1 ≠ 0) :
Commute (projection i) (projection j) := by
change _ * _ = _ * _
ext h l
rw [projection_mul_apply, projection_mul_apply]
apply Finset.prod_congr rfl
intro S _
rw [(localProjection_commute S _ _ _ _ hij).eq]
universe v1965_0
lemma card_subsets_containing {α : Type v1965_0} [Fintype α] [DecidableEq α]
(a : α) (r : ℕ) (hr : 1 ≤ r)
[Fintype {A : Finset α // A.card=r ∧ a ∈ A}] :
Fintype.card {A : Finset α // A.card=r ∧ a ∈ A} =
Nat.choose (Fintype.card α - 1) (r-1) := by
rw [Fintype.card_of_subtype
(((Finset.univ : Finset α).powersetCard r).filter ({a} ⊆ ·)) (by
intro A
simp only [Finset.mem_filter, Finset.mem_powersetCard, Finset.subset_univ,
true_and, Finset.singleton_subset_iff])]
rw [Finset.card_filter_powersetCard_subset _ _ _ (Finset.subset_univ _)
(by simpa only [Finset.card_singleton] using hr)]
simp only [Finset.card_univ, Finset.card_singleton]
lemma card_base : Fintype.card Base = b := by
let : Fintype {A : Finset (Fin k) // A.card=514 ∧ (0 : Fin k) ∈ A} :=
inferInstanceAs (Fintype Base)
have h := card_subsets_containing (0 : Fin k) 514 (by decide)
change Fintype.card Base = Nat.choose (Fintype.card (Fin k)-1) (514-1) at h
rw [Fintype.card_fin] at h
delta b
exact h.trans (congrArg₂ Nat.choose (show k-1=1027 from rfl) (show 514-1=513 from rfl))
lemma card_question : Fintype.card Question = Q := by
rw [Fintype.card_congr (show Question ≃ (Fin 3 → Base) from Equiv.refl _)]
rw [Fintype.card_fun, Fintype.card_fin, card_base]
delta Q
rfl
universe v1995_0
lemma signed_overlap {α : Type v1995_0} [Fintype α] [DecidableEq α] (A B : Finset α) :
(∑ h, (if h ∈ A then (1:ℝ) else -1) * (if h ∈ B then 1 else -1)) =
Fintype.card α - 2*(A.card:ℝ) - 2*(B.card:ℝ) + 4*(A ∩ B).card := by
have hp (h : α) :
(if h ∈ A then (1:ℝ) else -1) * (if h ∈ B then 1 else -1) =
1 - 2*(if h ∈ A then 1 else 0) - 2*(if h ∈ B then 1 else 0) +
4*(if h ∈ A ∩ B then 1 else 0) := by
by_cases ha : h ∈ A <;> by_cases hb : h ∈ B <;> simp [ha,hb] <;> norm_num
simp only [hp, Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum]
simp
congr 1
ext x
simp
lemma base_inner (A B : Base) :
(∑ h, baseVector A h * baseVector B h) = (A.1 ∩ B.1).card / (p:ℝ) - 1 := by
simp only [baseVector, div_mul_div_comm, ← Finset.sum_div]
rw [Real.mul_self_sqrt (by norm_num : (0:ℝ) ≤ k), signed_overlap]
rw [A.2.1,B.2.1]
simp only [Fintype.card_fin, k, p]
push_cast
ring
lemma base_unit (A : Base) : ∑ h, baseVector A h * baseVector A h = 1 := by
rw [base_inner, Finset.inter_self, A.2.1]
norm_num [p]
lemma vector_unit (q : Question) : overlap q q = 1 := by
change Lex (Fin 3 → Base) at q
unfold overlap vector
simp only [← Finset.prod_mul_distrib]
rw [← Fintype.prod_sum (fun l h => baseVector (ofLex q l) h * baseVector (ofLex q l) h)]
simp only [base_unit, Finset.prod_const_one]
@[irreducible] def a₀ : ℕ := ∑ j ∈ Finset.range p, Nat.choose k j
open Finset
lemma choose_mono_small {n i j : ℕ} (hij : i ≤ j) (hj : j ≤ n/2) :
Nat.choose n i ≤ Nat.choose n j := by
induction hij with
| refl => rfl
| @step j hij ih =>
exact (ih (by omega)).trans (Nat.choose_le_succ_of_lt_half_left (by omega))
lemma a₀_upper : a₀ ≤ 257 * Nat.choose 1028 257 := by
delta a₀
calc
(∑ j ∈ range 257, Nat.choose 1028 j) ≤ ∑ _j ∈ range 257, Nat.choose 1028 257 := by
apply sum_le_sum
intro j hj
exact choose_mono_small (Nat.le_of_lt (mem_range.mp hj)) (by decide)
_ = _ := by rw [sum_const, card_range, nsmul_eq_mul, Nat.cast_id]
lemma binomial_term_le (n j x y : ℕ) (hj : j ≤ n) :
x^j*y^(n-j)*Nat.choose n j ≤ (x+y)^n := by
rw [add_pow]
exact single_le_sum (f := fun m => x^m*y^(n-m)*Nat.choose n m)
(fun _ _ => Nat.zero_le _) (show j ∈ range (n+1) from mem_range.mpr (by omega))
lemma choose_upper : Nat.choose 1028 257 < 12^257 := by
have ht := binomial_term_le 1028 257 1 3 (by decide)
simp only [one_pow, one_mul, show 1028-257=771 from rfl, show 1+3=4 from rfl] at ht
have hn : (4:ℕ)^1028 < 3^771*12^257 := by
have hh := pow_lt_pow_left₀ (by norm_num : (4:ℕ)^4 < 3^3*12) (by positivity) (by decide : 257 ≠ 0)
have hl : ((4:ℕ)^4)^257 = 4^1028 := by rw [← pow_mul]
have hr : ((3:ℕ)^3*12)^257 = 3^771*12^257 :=
by rw [mul_pow, ← pow_mul]
exact (congrArg₂ (fun x y : ℕ => x<y) hl hr).mp hh
have hh : 3^771 * Nat.choose 1028 257 < 3^771 * 12^257 := lt_of_le_of_lt ht hn
exact Nat.lt_of_mul_lt_mul_left hh
lemma double_b : Nat.choose 1028 514 = 2*b := by
delta b
have hs : Nat.choose 1027 514 = Nat.choose 1027 513 :=
Nat.choose_symm_of_eq_add (show 1027=514+513 from rfl)
calc
Nat.choose 1028 514 = Nat.choose 1027 513 + Nat.choose 1027 514 :=
(congrArg₂ Nat.choose (show 1028=Nat.succ 1027 from rfl)
(show 514=Nat.succ 513 from rfl)).trans ((Nat.choose_succ_succ 1027 513).trans
(congrArg (fun x => Nat.choose 1027 513 + x)
(congrArg (Nat.choose 1027) (show Nat.succ 513=514 from rfl))))
_ = 2 * Nat.choose 1027 513 := by rw [hs]; omega
lemma b_lower : 2^1028 ≤ 2058*b := by
have h : (∑ j ∈ range (1028+1), Nat.choose 1028 j) ≤
∑ _j ∈ range (1028+1), Nat.choose 1028 514 :=
sum_le_sum (fun j _ => Nat.choose_le_middle j 1028)
rw [Nat.sum_range_choose, sum_const, card_range, nsmul_eq_mul, double_b] at h
simpa only [Nat.cast_id, show 1028+1=1029 from rfl, ← Nat.mul_assoc, show 1029*2=2058 from rfl] using h
lemma strict_parameter_bound : 3*a₀*K < b := by
have ha := a₀_upper
have hc := choose_upper
have hb := b_lower
have ha' : a₀ < 257*12^257 := lt_of_le_of_lt ha (Nat.mul_lt_mul_of_pos_left hc (by decide))
have hn : (2058:ℕ)*(3*(257*12^257)*1028^3) < 2^1028 := by
calc
(2058:ℕ)*(3*(257*12^257)*1028^3) < 16^257 := by
rw [show 257=256+1 from rfl, pow_add, pow_add]
norm_num
_ = 2^1028 := by
calc
(16 : ℕ)^257 = ((2 : ℕ)^4)^257 := congrArg (fun value : ℕ => value^257) (show 16 = 2^4 from rfl)
_ = 2^1028 := by rw [← pow_mul]
delta K
change 3*a₀*1028^3 < b
apply Nat.lt_of_mul_lt_mul_left (a := 2058)
exact lt_of_le_of_lt (Nat.mul_le_mul_left 2058
(Nat.mul_le_mul_right (1028^3) (Nat.mul_le_mul_left 3 (Nat.le_of_lt ha')))) (hn.trans_le hb)
lemma b_pos : 0 < b := lt_of_le_of_lt (Nat.zero_le _) strict_parameter_bound
end
universe v2431_0
lemma card_subsets {α : Type v2431_0} [Fintype α] [DecidableEq α] (r : ℕ)
[Fintype {S : Finset α // S.card=r}] :
Fintype.card {S : Finset α // S.card=r} = Nat.choose (Fintype.card α) r := by
rw [Fintype.card_of_subtype ((Finset.univ : Finset α).powersetCard r) (by
intro S
simp only [Finset.mem_powersetCard, Finset.subset_univ, true_and])]
rw [Finset.card_powersetCard, Finset.card_univ]
lemma card_eightSet : Fintype.card EightSet = Nat.choose Q 8 := by
let : Fintype {S : Finset Question // S.card=8} := inferInstanceAs (Fintype EightSet)
exact (card_subsets (α := Question) 8).trans (congrArg (fun n => Nat.choose n 8) card_question)
lemma card_basis_aux : Fintype.card Basis = Fintype.card LocalBasis ^ Fintype.card EightSet := by
rw [← Nat.card_eq_fintype_card, ← Nat.card_eq_fintype_card, ← Nat.card_eq_fintype_card]
exact (Nat.card_congr (show Basis ≃ (EightSet → LocalBasis) from Equiv.refl _)).trans Nat.card_fun
lemma card_localBasis : Fintype.card LocalBasis = 4 := by
rw [Fintype.card_congr (show LocalBasis ≃ (Fin 2 × Fin 2) from Equiv.refl _),
Fintype.card_prod, Fintype.card_fin]
lemma card_basis : Fintype.card Basis = D := by
exact (card_basis_aux.trans (congrArg₂ (fun a b : ℕ => a^b) card_localBasis card_eightSet)).trans D_eq.symm
lemma card_outcomeString : Fintype.card OutcomeString = D :=
(Fintype.card_congr (show OutcomeString ≃ Basis from Equiv.refl _)).trans card_basis
lemma card_label : Fintype.card Label = m := by
rw [Fintype.card_congr (show Label ≃ (Question × OutcomeString) from Equiv.refl _)]
rw [Fintype.card_prod, card_question, card_outcomeString]
exact m_eq.symm
def basisOrder : Fin D ≃o Basis := Fintype.orderIsoFinOfCardEq Basis card_basis
def labelOrder : Fin m ≃o Label := Fintype.orderIsoFinOfCardEq Label (by
have cardContaining {α : Type} [Fintype α] [DecidableEq α]
(a : α) (r : ℕ) (hr : 1 ≤ r)
[Fintype {A : Finset α // A.card = r ∧ a ∈ A}] :
Fintype.card {A : Finset α // A.card = r ∧ a ∈ A} =
Nat.choose (Fintype.card α - 1) (r - 1) := by
as_aux_lemma =>
rw [Fintype.card_of_subtype
(((Finset.univ : Finset α).powersetCard r).filter ({a} ⊆ ·)) (by
intro A
simp only [Finset.mem_filter, Finset.mem_powersetCard, Finset.subset_univ,
true_and, Finset.singleton_subset_iff])]
rw [Finset.card_filter_powersetCard_subset _ _ _ (Finset.subset_univ _)
(by simpa only [Finset.card_singleton] using hr)]
simp only [Finset.card_univ, Finset.card_singleton]
have hbase : Fintype.card Base = b := by
as_aux_lemma =>
let : Fintype {A : Finset (Fin k) // A.card = 514 ∧ (0 : Fin k) ∈ A} :=
inferInstanceAs (Fintype Base)
have h := cardContaining (0 : Fin k) 514 (by decide)
change Fintype.card Base = Nat.choose (Fintype.card (Fin k) - 1) (514 - 1) at h
rw [Fintype.card_fin] at h
delta b
exact h.trans (congrArg₂ Nat.choose (show k - 1 = 1027 from rfl)
(show 514 - 1 = 513 from rfl))
have hquestion : Fintype.card Question = Q := by
calc
Fintype.card Question = Fintype.card (Fin 3 → Base) :=
Fintype.card_congr (show Question ≃ (Fin 3 → Base) from Equiv.refl _)
_ = Fintype.card Base ^ Fintype.card (Fin 3) := Fintype.card_fun
_ = b ^ 3 := congrArg₂ (fun x y : ℕ => x ^ y) hbase (Fintype.card_fin 3)
_ = Q := Q.eq_def.symm
have height : Fintype.card EightSet = Nat.choose Q 8 := by
as_aux_lemma =>
let : Fintype {S : Finset Question // S.card = 8} := inferInstanceAs (Fintype EightSet)
change Fintype.card {S : Finset Question // S.card = 8} = _
rw [Fintype.card_of_subtype ((Finset.univ : Finset Question).powersetCard 8) (by
intro S
simp only [Finset.mem_powersetCard, Finset.subset_univ, true_and])]
rw [Finset.card_powersetCard, Finset.card_univ, hquestion]
have hlocal : Fintype.card Outcome = 4 := by
as_aux_lemma =>
rw [Fintype.card_congr (show Outcome ≃ (Fin 2 × Fin 2) from Equiv.refl _),
Fintype.card_prod, Fintype.card_fin]
have houtcome : Fintype.card OutcomeString = D := by
as_aux_lemma =>
calc
Fintype.card OutcomeString = Fintype.card Outcome ^ Fintype.card EightSet := by
rw [Fintype.card_congr (show OutcomeString ≃ (EightSet → Outcome) from Equiv.refl _),
Fintype.card_fun]
_ = 4 ^ Nat.choose Q 8 := congrArg₂ (fun a b : ℕ => a ^ b) hlocal height
_ = D := by
have hd (q : ℕ) : dimensionFunction q = 4 ^ Nat.choose q 8 := rfl
symm
unfold D
exact hd Q
rw [Fintype.card_congr (show Label ≃ (Question × OutcomeString) from Equiv.refl _)]
rw [Fintype.card_prod, hquestion, houtcome]
have hm (q d : ℕ) : outputDimensionFunction q d = q * d := rfl
symm
unfold m
exact hm Q D)
def rhoFin : Matrix (Fin m × Fin m) (Fin m × Fin m) ℂ :=
rho.submatrix (Prod.map labelOrder labelOrder) (Prod.map labelOrder labelOrder)
lemma overlap_symm (q r : Question) : overlap q r = overlap r q := by
unfold overlap
exact Finset.sum_congr rfl (fun h _ => mul_comm _ _)
lemma projection_transpose (i : Label) : (projection i)ᵀ = projection i := by
ext h l
have hh := congrArg (fun A : Matrix Basis Basis ℂ => A h l)
(show (projection i)ᴴ=projection i from (projection_projection i).isSelfAdjoint)
exact (projection_real i l h).symm.trans hh
lemma block_swap (i j : Label) : block i j = block j i := by
by_cases h : overlap (ofLex i).1 (ofLex j).1 = 0
· simp only [block, ← overlap_symm (ofLex i).1 (ofLex j).1, h,
Complex.ofReal_zero, zero_smul]
· unfold block
rw [overlap_symm, (projection_commute i j h).eq]
lemma block_transpose (i j : Label) : (block i j)ᵀ = block i j := by
by_cases h : overlap (ofLex i).1 (ofLex j).1 = 0
· simp only [block, h, Complex.ofReal_zero, zero_smul, Matrix.transpose_zero]
· unfold block
rw [Matrix.transpose_smul, Matrix.transpose_mul, projection_transpose, projection_transpose,
(projection_commute i j h).eq]
lemma block_diag (i : Label) : block i i = projection i := by
unfold block
rw [vector_unit, Complex.ofReal_one, one_smul, (projection_projection i).isIdempotentElem]
lemma rawOutput_trace (i j : Label × Label) :
rawOutput i j = trace (block i.1 j.1 * block i.2 j.2) := by
rw [← block_transpose i.1 j.1]
simp only [rawOutput, trace, Matrix.diag_apply, Matrix.mul_apply, Matrix.transpose_apply]
lemma rawOutput_crossed_diagonal (i j : Label) :
rawOutput (i,j) (i,j) = trace (projection i * projection j) := by
rw [rawOutput_trace, block_diag, block_diag]
def makeLabel (q : Question) (a : OutcomeString) : Label := toLex (q,a)
lemma projection_sum_makeLabel (q : Question) : ∑ a, projection (makeLabel q a) = 1 := projection_sum q
universe v2545_0
lemma sum_label {M : Type v2545_0} [AddCommMonoid M] (f : Label → M) :
∑ i, f i = ∑ q : Question, ∑ a : OutcomeString, f (makeLabel q a) := by
exact (Equiv.sum_comp (show (Question × OutcomeString) ≃ Label from Equiv.refl _) f).symm.trans
(Fintype.sum_prod_type _)
lemma sum_projection_pair_trace (q r : Question) :
(∑ a : OutcomeString, ∑ b : OutcomeString,
trace (projection (makeLabel q a) * projection (makeLabel r b))) = (D : ℂ) := by
have h : (∑ a : OutcomeString, ∑ b : OutcomeString,
projection (makeLabel q a) * projection (makeLabel r b)) = 1 := by
simp_rw [← Finset.mul_sum, projection_sum_makeLabel, mul_one]
exact projection_sum_makeLabel q
have hh := congrArg Matrix.trace h
simpa only [trace_sum, trace_one, card_basis] using hh
lemma rawOutput_trace_total : trace rawOutput = (Q^2*D : ℕ) := by
change (∑ i : Label × Label, rawOutput i i) = _
rw [Fintype.sum_prod_type]
simp_rw [rawOutput_crossed_diagonal, sum_label]
conv_lhs =>
arg 2; ext q
rw [Finset.sum_comm]
simp_rw [sum_projection_pair_trace]
simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, card_question,
Nat.cast_mul, Nat.cast_pow]
ring
end Explicit
open scoped MatrixOrder ComplexOrder Kronecker
open Matrix
universe v2604_0 v2604_1
def Separable {ι : Type v2604_0} {κ : Type v2604_1} [Fintype ι] [Fintype κ]
(R : Matrix (ι × κ) (ι × κ) ℂ) : Prop :=
∃ (n : ℕ) (A : Fin n → Matrix ι ι ℂ) (B : Fin n → Matrix κ κ ℂ),
(∀ s, (A s).PosSemidef) ∧ (∀ s, (B s).PosSemidef) ∧ R = ∑ s, A s ⊗ₖ B s
open Finset
namespace Explicit
lemma Q_pos : 0 < Q := by unfold Q; exact pow_pos b_pos 3
lemma D_pos : 0 < D := by rw [D_eq]; exact pow_pos (by decide) _
end Explicit
open scoped ComplexOrder MatrixOrder Kronecker
open Matrix
section
universe v2846_0 v2846_1 v2846_2
variable {α : Type v2846_0} {β : Type v2846_1} {γ : Type v2846_2} [inst2846_0 : Fintype α] [inst2846_1 : Fintype β] [inst2846_2 : Fintype γ]
def projectionKraus (u : β → γ → ℝ) (P : β → Matrix α α ℂ) :
(γ × α) → Matrix β α ℂ := fun s i a => (u i s.1 : ℂ) * P i s.2 a
omit inst2846_1 in
lemma projectionKraus_coeff [Fintype β] (u : β → γ → ℝ) (P : β → Matrix α α ℂ)
(hP : ∀ i, (P i).IsHermitian) (i j : β) (a b : α) :
(∑ s, projectionKraus u P s i a * star (projectionKraus u P s j b)) =
(∑ h, (u i h : ℂ) * (u j h : ℂ)) * (P j * P i) b a := by
simp only [projectionKraus, Fintype.sum_prod_type, star_mul, Complex.star_def,
Complex.conj_ofReal]
have hp (l : α) : star (P j l b) = P j b l := congrArg (fun A : Matrix α α ℂ => A b l) (hP j).eq
simp only [← Complex.star_def, hp, Matrix.mul_apply, Finset.sum_mul, Finset.mul_sum]
rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro h _
apply Finset.sum_congr rfl
intro l _
ring
lemma projectionKraus_formula (u : β → γ → ℝ) (P : β → Matrix α α ℂ)
(hP : ∀ i, (P i).IsHermitian) (U : Matrix α α ℂ) (i j : β) :
(∑ s, projectionKraus u P s * U * (projectionKraus u P s)ᴴ) i j =
trace (((∑ h, (u i h : ℂ) * (u j h : ℂ)) • (P j * P i)) * U) := by
simp only [Matrix.sum_apply, Matrix.mul_apply, Matrix.conjTranspose_apply]
simp only [Finset.sum_mul]
calc
_ = ∑ b, ∑ a, (∑ s, projectionKraus u P s i a * star (projectionKraus u P s j b)) * U a b := by
simp only [Finset.sum_mul]
rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro b _
rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro a _
apply Finset.sum_congr rfl
intro s _
ring
_ = _ := by
simp only [projectionKraus_coeff u P hP, trace, Matrix.diag_apply,
Matrix.mul_apply, Matrix.smul_apply, smul_eq_mul]
end
namespace Explicit
def questionFin (i : Fin m) : Question := (ofLex (labelOrder i)).1
def projectionFin (i : Fin m) : Mat D := (projection (labelOrder i)).submatrix basisOrder basisOrder
def blockFin (i j : Fin m) : Mat D := (block (labelOrder i) (labelOrder j)).submatrix basisOrder basisOrder
def constructionMapFin : Mat D →ₗ[ℂ] Mat m := traceBlockMap blockFin
lemma projectionFin_hermitian (i : Fin m) : (projectionFin i).IsHermitian :=
(show (projection (labelOrder i)).IsHermitian from
(projection_projection (labelOrder i)).isSelfAdjoint).submatrix _
lemma blockFin_swap (i j : Fin m) : blockFin i j = blockFin j i := by
unfold blockFin
rw [block_swap]
lemma blockFin_formula (i j : Fin m) : blockFin i j =
(overlap (questionFin i) (questionFin j) : ℂ) •
(projectionFin i * projectionFin j) := by
unfold blockFin block projectionFin
change _ = (overlap (questionFin i) (questionFin j) : ℂ) • _
have hh := (Matrix.submatrix_mul_equiv (projection (labelOrder i)) (projection (labelOrder j))
basisOrder basisOrder.toEquiv basisOrder).symm
exact congrArg (fun A : Mat D => (overlap (questionFin i) (questionFin j) : ℂ) • A) hh
lemma constructionMapFin_kraus (U : Mat D) : constructionMapFin U =
∑ s, projectionKraus (fun i => vector (questionFin i)) projectionFin s * U *
(projectionKraus (fun i => vector (questionFin i)) projectionFin s)ᴴ := by
ext i j
change trace (blockFin i j * U) = _
rw [projectionKraus_formula _ _ projectionFin_hermitian]
rw [blockFin_swap i j, blockFin_formula]
have hc : (overlap (questionFin j) (questionFin i) : ℂ) =
∑ h, (vector (questionFin i) h : ℂ) * (vector (questionFin j) h : ℂ) := by
rw [overlap_symm]
simp only [← Complex.ofReal_mul, ← Complex.ofReal_sum]
rfl
rw [hc]
lemma constructionMapFin_cp : CompletelyPositive constructionMapFin :=
cp_of_kraus_representation _ _ constructionMapFin_kraus
lemma constructionMapFin_unit (x y : Fin D) (i j : Fin m) :
constructionMapFin (matrixUnit x y) i j = blockFin i j y x := by
change trace (blockFin i j * matrixUnit x y) = _
simp [trace, Matrix.diag_apply, Matrix.mul_apply, matrixUnit, ite_and]
def omegaVector : Fin D × Fin D → ℂ := fun i => if i.1=i.2 then 1 else 0
def rawOutputFin : Matrix (Fin m × Fin m) (Fin m × Fin m) ℂ :=
rawOutput.submatrix (Prod.map labelOrder labelOrder) (Prod.map labelOrder labelOrder)
lemma rawOutputFin_tensor : rawOutputFin =
tensorMap constructionMapFin constructionMapFin (outer omegaVector omegaVector) := by
ext ⟨i,a⟩ ⟨j,b⟩
change rawOutput (labelOrder i, labelOrder a) (labelOrder j, labelOrder b) = _
simp only [tensorMap, outer, omegaVector, constructionMapFin_unit, apply_ite,
star_one, star_zero, ite_mul, one_mul, zero_mul, mul_zero]
simp only [Finset.sum_ite_eq, Finset.mem_univ, ite_true]
change (∑ h, ∑ l, block (labelOrder i) (labelOrder j) l h *
block (labelOrder a) (labelOrder b) l h) =
∑ h : Fin D, ∑ l : Fin D, block (labelOrder i) (labelOrder j) (basisOrder l) (basisOrder h) *
block (labelOrder a) (labelOrder b) (basisOrder l) (basisOrder h)
rw [← Equiv.sum_comp basisOrder.toEquiv]
apply Finset.sum_congr rfl
intro h _
exact (Equiv.sum_comp basisOrder.toEquiv _).symm
lemma rawOutputFin_psd : rawOutputFin.PosSemidef := by
rw [rawOutputFin_tensor]
exact tensorMap_positive constructionMapFin_cp constructionMapFin_cp (outer_posSemidef _)
lemma rawOutputFin_trace : trace rawOutputFin = ((Q^2*D : ℕ) : ℂ) := by
rw [← rawOutput_trace_total]
unfold trace
exact Equiv.sum_comp (labelOrder.toEquiv.prodCongr labelOrder.toEquiv)
(fun x : Label × Label => rawOutput x x)
lemma rhoFin_eq : rhoFin = ((Q^2*D : ℕ) : ℂ)⁻¹ • rawOutputFin := rfl
lemma symbolic_normalization_ne_zero (q d : ℕ) (hq : 0 < q) (hd : 0 < d) :
((q^2*d : ℕ) : ℂ) ≠ 0 := by
exact Nat.cast_ne_zero.mpr (mul_pos (pow_pos hq 2) hd).ne'
lemma normalization_ne_zero : ((Q^2*D : ℕ) : ℂ) ≠ 0 :=
symbolic_normalization_ne_zero Q D Q_pos D_pos
lemma rhoFin_density : Density rhoFin := by
rw [rhoFin_eq]
constructor
· exact rawOutputFin_psd.smul (inv_nonneg.mpr (Nat.cast_nonneg _))
· rw [trace_smul, rawOutputFin_trace, smul_eq_mul, inv_mul_cancel₀ normalization_ne_zero]
end Explicit
end ZeroKey
namespace UnrestrictedQuantum
open Matrix MeasureTheory
open scoped ComplexOrder MatrixOrder
universe v3096_0 v3096_1 v3096_2 v3096_3 v3096_4
variable {A : Type v3096_0} {B : Type v3096_1} {C : Type v3096_2} [inst3096_0 : AddCommGroup A] [inst3096_1 : Module ℂ A] [inst3096_2 : One A]
[inst3096_3 : AddCommGroup B] [inst3096_4 : Module ℂ B] [inst3096_5 : One B]
[inst3096_6 : AddCommGroup C] [inst3096_7 : Module ℂ C] [inst3096_8 : One C]
{ι : Type v3096_3} {κ : Type v3096_4} [inst3096_9 : Fintype ι] [inst3096_10 : Fintype κ] [inst3096_11 : DecidableEq ι] [inst3096_12 : DecidableEq κ]
universe v3101_0 v3101_1
abbrev ReferenceFunctional (A : Type v3101_0) [AddCommGroup A] [Module ℂ A]
(ι : Type v3101_1) := A →ₗ[ℂ] Matrix ι ι ℂ
def PositiveFunctional [LE A] (S : ReferenceFunctional A ι) : Prop :=
∀ x, 0 ≤ x → (S x).PosSemidef
universe v3140_0 v3140_1 v3140_2
structure ObservableInstrument (O : Type v3140_0) [MeasurableSpace O]
(A : Type v3140_1) (B : Type v3140_2) [AddCommGroup A] [Module ℂ A] [One A] [LE A]
[AddCommGroup B] [Module ℂ B] [One B] [LE B] where
operation : Set O → B →ₗ[ℂ] A
positive : ∀ E, MeasurableSet E → ∀ x, 0 ≤ x → 0 ≤ operation E x
total_unit : operation Set.univ 1 = 1
universe v3147_0
variable {O : Type v3147_0} [inst3147_0 : MeasurableSpace O] [inst3147_1 : LE A] [inst3147_2 : LE B]
(J : ObservableInstrument O A B) (S : ReferenceFunctional A ι)
structure InstrumentRun where
law : Measure O
probability : IsProbabilityMeasure law
posterior : O → ReferenceFunctional B ι
posterior_positive : ∀ o, PositiveFunctional (posterior o)
posterior_trace : ∀ o, trace (posterior o 1) = 1
integrable : ∀ x i j, Integrable (fun o => posterior o x i j) law
update : ∀ E, MeasurableSet E → ∀ x i j,
(∫ o in E, posterior o x i j ∂law) = S (J.operation E x) i j
namespace InstrumentRun
variable (r : InstrumentRun J S)
omit inst3096_11 in
theorem reference_mean [DecidableEq ι] (i j : ι) :
(∫ o, r.posterior o 1 i j ∂r.law) = S 1 i j := by
simpa only [Measure.restrict_univ, J.total_unit] using
r.update Set.univ MeasurableSet.univ 1 i j
end InstrumentRun
end UnrestrictedQuantum
namespace ZeroKey
section
open MeasureTheory ProbabilityTheory Set Function unitInterval
open scoped ENNReal
section
universe v3216_0 v3216_1
theorem sample_instrument_kernel {S : Type v3216_0} {O : Type v3216_1} [MeasurableSpace S]
[MeasurableSpace O] [StandardBorelSpace O] [Nonempty O]
(κ : Kernel S O) [IsMarkovKernel κ] :
∃ f : S → I → O, Measurable (uncurry f) ∧
(∀ s, volume.map (f s) = κ s) ∧
∀ (μ : Measure S) [IsFiniteMeasure μ],
(μ.prod (volume : Measure I)).map (fun p => (p.1, f p.1 p.2)) = μ ⊗ₘ κ := by
obtain ⟨f,hf,hfLaw⟩ := κ.exists_measurable_map_eq_unitInterval
change Measurable (fun p : S × I => f p.1 p.2) at hf
refine ⟨f,hf,hfLaw,?_⟩
intro μ hμ
ext B hB
rw [Measure.map_apply (measurable_fst.prodMk hf) hB,
Measure.prod_apply (hB.preimage (measurable_fst.prodMk hf)),
Measure.compProd_apply hB]
congr 1
funext s
rw [← hfLaw s, Measure.map_apply hf.of_uncurry_left (measurable_prodMk_left hB)]
rfl
abbrev UniformTape := ℕ → I
def uniformTapeLaw : Measure UniformTape :=
Measure.infinitePi (fun _ : ℕ => (volume : Measure I))
instance : IsProbabilityMeasure uniformTapeLaw := by
unfold uniformTapeLaw
infer_instance
end
open MeasureTheory ProbabilityTheory Filter
open scoped ENNReal
section
universe v3447_0
variable {Ω : Type v3447_0} {mΩ : MeasurableSpace Ω} [inst3447_0 : StandardBorelSpace Ω]
{μ : Measure Ω} [inst3447_1 : IsFiniteMeasure μ]
lemma indicator_one_mul (s : Set Ω) (f : Ω → ℝ) :
s.indicator (fun _ => (1:ℝ)) * f = s.indicator f := by
ext x
by_cases hx : x∈s <;> simp [hx]
lemma indicator_inter_one (s t : Set Ω) :
(s∩t).indicator (fun _ => (1:ℝ)) =
s.indicator (t.indicator (fun _ => (1:ℝ))) := by
ext x
by_cases hs : x∈s <;> by_cases ht : x∈t <;> simp [hs,ht]
lemma condIndep_condExp_right {C A B : MeasurableSpace Ω}
(hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) (hCA : C ≤ A)
(h : CondIndep C A B hC μ) {t : Set Ω} (ht : MeasurableSet[B] t) :
μ[t.indicator (fun _ => (1:ℝ)) | A] =ᵐ[μ]
μ[t.indicator (fun _ => (1:ℝ)) | C] := by
let f := t.indicator (fun _ : Ω => (1:ℝ))
have hf : Integrable f μ := (integrable_const (1:ℝ)).indicator (hB t ht)
symm
apply ae_eq_condExp_of_forall_setIntegral_eq hA hf
· intro s hs hμs
exact integrable_condExp.integrableOn
· intro s hs hμs
have hs' : MeasurableSet[mΩ] s := hA s hs
have hsi : Integrable (s.indicator (fun _ : Ω => (1:ℝ))) μ :=
(integrable_const (1:ℝ)).indicator hs'
have hprod : Integrable (s.indicator (fun _ : Ω => (1:ℝ)) * μ[f | C]) μ := by
rw [indicator_one_mul]
exact integrable_condExp.indicator hs'
have hp := condExp_mul_of_stronglyMeasurable_right
(stronglyMeasurable_condExp (μ := μ) (m := C) (f := f)) hprod hsi
rw [indicator_one_mul] at hp
have hh := ((condIndep_iff C A B hC hA hB μ).mp h) s t hs ht
change μ[(s∩t).indicator (fun _ => (1:ℝ)) | C] =ᵐ[μ]
μ[s.indicator (fun _ => (1:ℝ)) | C] * μ[f | C] at hh
calc
(∫ x in s, μ[f | C] x ∂μ) = ∫ x, s.indicator (μ[f | C]) x ∂μ :=
(integral_indicator hs').symm
_ = ∫ x, μ[s.indicator (μ[f | C]) | C] x ∂μ := (integral_condExp hC).symm
_ = ∫ x, μ[(s∩t).indicator (fun _ => (1:ℝ)) | C] x ∂μ :=
integral_congr_ae (hp.trans hh.symm)
_ = ∫ x, (s∩t).indicator (fun _ => (1:ℝ)) x ∂μ := integral_condExp hC
_ = ∫ x in s, f x ∂μ := by
rw [indicator_inter_one, integral_indicator hs']
· exact (stronglyMeasurable_condExp.mono hCA).aestronglyMeasurable
lemma condIndep_local_refinement {C N A B : MeasurableSpace Ω}
(hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ)
(hCA : C ≤ A) (hCN : C ≤ N) (hNA : N ≤ A)
(h : CondIndep C A B hC μ) :
CondIndep N A B (hNA.trans hA) μ := by
have hN := hNA.trans hA
rw [condIndep_iff N A B hN hA hB]
intro s t hs ht
let f := t.indicator (fun _ : Ω => (1:ℝ))
have hf : Integrable f μ := (integrable_const (1:ℝ)).indicator (hB t ht)
have hp : μ[f | A] =ᵐ[μ] μ[f | C] := condIndep_condExp_right hC hA hB hCA h ht
have hcN : μ[μ[f | C] | N] = μ[f | C] :=
condExp_of_stronglyMeasurable hN (stronglyMeasurable_condExp.mono hCN) integrable_condExp
have htN : μ[f | N] =ᵐ[μ] μ[f | C] := by
calc
_ =ᵐ[μ] μ[μ[f | A] | N] := (condExp_condExp_of_le hNA hA).symm
_ =ᵐ[μ] μ[μ[f | C] | N] := condExp_congr_ae hp
_ =ᵐ[μ] μ[f | C] := by rw [hcN]
have hsep : μ[s.indicator f | A] =ᵐ[μ] s.indicator (μ[f | C]) := by
apply (condExp_indicator hf hs).trans
filter_upwards [hp] with x hx
by_cases hxs : x∈s <;> simp [hxs,hx]
have hsi : Integrable (s.indicator (fun _ : Ω => (1:ℝ))) μ :=
(integrable_const (1:ℝ)).indicator (hA s hs)
have hprod : Integrable (s.indicator (fun _ : Ω => (1:ℝ)) * μ[f | C]) μ := by
rw [indicator_one_mul]
exact integrable_condExp.indicator (hA s hs)
have hpull := condExp_mul_of_stronglyMeasurable_right
(stronglyMeasurable_condExp.mono hCN) hprod hsi
rw [indicator_one_mul] at hpull
change μ[(s∩t).indicator (fun _ => (1:ℝ)) | N] =ᵐ[μ]
μ[s.indicator (fun _ => (1:ℝ)) | N] * μ[f | N]
rw [indicator_inter_one]
calc
_ =ᵐ[μ] μ[μ[s.indicator f | A] | N] := (condExp_condExp_of_le hNA hA).symm
_ =ᵐ[μ] μ[s.indicator (μ[f | C]) | N] := condExp_congr_ae hsep
_ =ᵐ[μ] μ[s.indicator (fun _ => (1:ℝ)) | N] * μ[f | C] := hpull
_ =ᵐ[μ] _ := by
filter_upwards [htN] with x hx
simp only [Pi.mul_apply, hx]
def recordInterFamily (B C : MeasurableSpace Ω) : Set (Set Ω) :=
{s | ∃ b n, MeasurableSet[B] b ∧ MeasurableSet[C] n ∧ s = b∩n}
lemma recordInterFamily_pi (B C : MeasurableSpace Ω) : IsPiSystem (recordInterFamily B C) := by
rintro s ⟨b,n,hb,hn,rfl⟩ t ⟨b',n',hb',hn',rfl⟩ _
refine ⟨b∩b',n∩n',hb.inter hb',hn.inter hn',?_⟩
ext x
simp only [Set.mem_inter_iff]
tauto
lemma recordInterFamily_generate (B C : MeasurableSpace Ω) :
MeasurableSpace.generateFrom (recordInterFamily B C) = B ⊔ C := by
apply le_antisymm
· apply MeasurableSpace.generateFrom_le
rintro s ⟨b,n,hb,hn,rfl⟩
exact ((show B ≤ B ⊔ C from le_sup_left) b hb).inter
((show C ≤ B ⊔ C from le_sup_right) n hn)
· apply sup_le
· intro s hs
apply MeasurableSpace.measurableSet_generateFrom
exact ⟨s,Set.univ,hs,MeasurableSet.univ,(Set.inter_univ s).symm⟩
· intro s hs
apply MeasurableSpace.measurableSet_generateFrom
exact ⟨Set.univ,s,MeasurableSet.univ,hs,(Set.univ_inter s).symm⟩
lemma condIndep_join_public_right {C A B : MeasurableSpace Ω}
(hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ)
(h : CondIndep C A B hC μ) : CondIndep C A (B ⊔ C) hC μ := by
let p : Set (Set Ω) := {s | MeasurableSet[A] s}
have hp : IsPiSystem p := by
intro s hs t ht _
exact hs.inter ht
have hpg : A = MeasurableSpace.generateFrom p :=
(@MeasurableSpace.generateFrom_measurableSet Ω A).symm
have hpM : ∀ s ∈ p, MeasurableSet[mΩ] s := hA
have hrM : ∀ s ∈ recordInterFamily B C, MeasurableSet[mΩ] s := by
rintro s ⟨b,n,hb,hn,rfl⟩
exact (hB b hb).inter (hC n hn)
apply CondIndepSets.condIndep hA (sup_le hB hC) hp (recordInterFamily_pi B C)
hpg (recordInterFamily_generate B C).symm
rw [condIndepSets_iff C hC p (recordInterFamily B C) hpM hrM μ]
rintro s _ hs ⟨b,n,hb,hn,rfl⟩
have hsb : Integrable ((s∩b).indicator (fun _ : Ω => (1:ℝ))) μ :=
(integrable_const (1:ℝ)).indicator ((hA s hs).inter (hB b hb))
have hbI : Integrable (b.indicator (fun _ : Ω => (1:ℝ))) μ :=
(integrable_const (1:ℝ)).indicator (hB b hb)
have hleft := condExp_indicator hsb hn
have hright := condExp_indicator hbI hn
have he1 : (s∩(b∩n)).indicator (fun _ : Ω => (1:ℝ)) =
n.indicator ((s∩b).indicator (fun _ : Ω => (1:ℝ))) := by
ext x
by_cases hx : x∈n <;> by_cases hsx : x∈s <;> by_cases hbx : x∈b <;> simp [hx,hsx,hbx]
have he2 : (b∩n).indicator (fun _ : Ω => (1:ℝ)) =
n.indicator (b.indicator (fun _ : Ω => (1:ℝ))) := by
ext x
by_cases hx : x∈n <;> by_cases hbx : x∈b <;> simp [hx,hbx]
have hfactor := (condIndep_iff C A B hC hA hB μ).mp h s b hs hb
change μ[(s∩(b∩n)).indicator (fun _ => (1:ℝ)) | C] =ᵐ[μ]
μ[s.indicator (fun _ => (1:ℝ)) | C] * μ[(b∩n).indicator (fun _ => (1:ℝ)) | C]
rw [he1,he2]
filter_upwards [hleft,hright,hfactor] with x hx hy hz
change μ[n.indicator ((s∩b).indicator (fun _ => (1:ℝ))) | C] x =
μ[s.indicator (fun _ => (1:ℝ)) | C] x *
μ[n.indicator (b.indicator (fun _ => (1:ℝ))) | C] x
rw [hx,hy]
by_cases hxn : x∈n <;> simp [hxn,Pi.mul_apply] at hz ⊢
exact hz
lemma condIndep_local_message {C N A B : MeasurableSpace Ω}
(hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ) (hCN : C ≤ N)
(hNA : N ≤ A ⊔ C) (h : CondIndep C A B hC μ) :
CondIndep N A B (hNA.trans (sup_le hA hC)) μ := by
have hjoin : CondIndep C (A ⊔ C) B hC μ :=
(condIndep_join_public_right hC hB hA h.symm).symm
have href := condIndep_local_refinement hC (sup_le hA hC) hB
le_sup_right hCN hNA hjoin
exact condIndep_of_condIndep_of_le_left href le_sup_left
end
universe v3643_0
lemma condFactor_full_transcript {Ω : Type v3643_0} {mΩ : MeasurableSpace Ω} {μ : Measure Ω}
[inst3643_0 : IsFiniteMeasure μ]
(ℱ : Filtration ℕ mΩ) (f g : Ω → ℝ)
(h : ∀ n, μ[f*g | ℱ n] =ᵐ[μ] μ[f | ℱ n] * μ[g | ℱ n]) :
μ[f*g | ⨆ n, ℱ n] =ᵐ[μ] μ[f | ⨆ n, ℱ n] * μ[g | ⨆ n, ℱ n] := by
have he : ∀ᵐ x ∂μ, ∀ n, μ[f*g | ℱ n] x = μ[f | ℱ n] x * μ[g | ℱ n] x :=
ae_all_iff.mpr h
filter_upwards [he, tendsto_ae_condExp (ℱ := ℱ) (f*g),
tendsto_ae_condExp (ℱ := ℱ) f, tendsto_ae_condExp (ℱ := ℱ) g] with x hx hfg hf hg
exact tendsto_nhds_unique hfg ((hf.mul hg).congr (fun n => (hx n).symm))
lemma condIndep_full_transcript {Ω : Type v3643_0} {mΩ : MeasurableSpace Ω} {μ : Measure Ω}
[inst3643_0 : IsFiniteMeasure μ]
[StandardBorelSpace Ω]
(ℱ : Filtration ℕ mΩ) (mA mB : MeasurableSpace Ω) (hA : mA ≤ mΩ) (hB : mB ≤ mΩ)
(h : ∀ n, CondIndep (ℱ n) mA mB (ℱ.le n) μ) :
CondIndep (⨆ n, ℱ n) mA mB (iSup_le fun n => ℱ.le n) μ := by
rw [condIndep_iff _ _ _ _ hA hB]
intro s t hs ht
have hh (n : ℕ) := (condIndep_iff _ _ _ _ hA hB μ).mp (h n) s t hs ht
have he : (s ∩ t).indicator (fun _ : Ω => (1:ℝ)) =
s.indicator (fun _ : Ω => (1:ℝ)) * t.indicator (fun _ : Ω => (1:ℝ)) := by
ext x
by_cases hxs : x∈s <;> by_cases hxt : x∈t <;> simp [hxs,hxt]
simpa only [he] using condFactor_full_transcript ℱ (s.indicator (fun _ => (1:ℝ)))
(t.indicator (fun _ => (1:ℝ))) (by simpa only [he] using hh)
open MeasureTheory ProbabilityTheory Function Set
section
universe v3698_0
lemma indep_condIndep_bot {Ω : Type v3698_0} {mΩ : MeasurableSpace Ω}
[StandardBorelSpace Ω] {P : Measure Ω} [IsProbabilityMeasure P]
{A B : MeasurableSpace Ω} (hA : A ≤ mΩ) (hB : B ≤ mΩ) (h : Indep A B P) :
CondIndep ⊥ A B bot_le P := by
rw [condIndep_iff _ _ _ _ hA hB]
intro s t hs ht
have hmul := (h.indepSet_of_measurableSet hs ht).measure_inter_eq_mul
simp only [condExp_bot, integral_indicator (hA s hs), integral_indicator (hB t ht),
integral_indicator ((hA s hs).inter (hB t ht)), integral_const,
smul_eq_mul, mul_one]
exact Filter.Eventually.of_forall fun _ => by
simpa only [Measure.real, Measure.restrict_apply_univ, Pi.mul_apply, ENNReal.toReal_mul] using congrArg ENNReal.toReal hmul
universe v3715_0 v3715_1 v3715_2
structure LocalTapeProgram (U : Type v3715_0) (V : Type v3715_1) (M : Type v3715_2) [MeasurableSpace U]
[MeasurableSpace V] [MeasurableSpace M] where
alice : ℕ → Bool
sendA : (n : ℕ) → U × (Fin n → M) → M
sendB : (n : ℕ) → V × (Fin n → M) → M
measA : ∀ n, Measurable (sendA n)
measB : ∀ n, Measurable (sendB n)
namespace LocalTapeProgram
universe v3724_0 v3724_1 v3724_2
variable {U : Type v3724_0} {V : Type v3724_1} {M : Type v3724_2} [inst3724_0 : MeasurableSpace U] [inst3724_1 : MeasurableSpace V] [inst3724_2 : MeasurableSpace M]
(p : LocalTapeProgram U V M)
def publicPrefix : (n : ℕ) → U × V → (Fin n → M)
| 0, _ => Fin.elim0
| n+1, ω => Fin.snoc (publicPrefix n ω)
(if p.alice n then p.sendA n (ω.1,publicPrefix n ω) else p.sendB n (ω.2,publicPrefix n ω))
end LocalTapeProgram
end
open MeasureTheory ProbabilityTheory Function Set unitInterval
universe v3943_0 v3943_1
structure LocalOutcomeSampler (O : Type v3943_0) (M : Type v3943_1) [MeasurableSpace O] [MeasurableSpace M] where
alice : ℕ → Bool
sampleA : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × I → O
sampleB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × I → O
sendA : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M
sendB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M
sampleA_meas : ∀ n, Measurable (sampleA n)
sampleB_meas : ∀ n, Measurable (sampleB n)
sendA_meas : ∀ n, Measurable (sendA n)
sendB_meas : ∀ n, Measurable (sendB n)
namespace LocalOutcomeSampler
universe v3955_0 v3955_1
variable {O : Type v3955_0} {M : Type v3955_1} [inst3955_0 : MeasurableSpace O] [inst3955_1 : MeasurableSpace M]
(p : LocalOutcomeSampler O M)
def privatePrefix (a : Bool) : (n : ℕ) → UniformTape × (Fin n → M) → (Fin n → (O ⊕ Unit))
| 0, _ => Fin.elim0
| n+1, pair =>
let old := privatePrefix a n (pair.1,fun i => pair.2 i.castSucc)
let pubPast := fun i : Fin n => pair.2 i.castSucc
Fin.snoc old (if p.alice n = a then Sum.inl
(if a then p.sampleA n ((old,pubPast),pair.1 n)
else p.sampleB n ((old,pubPast),pair.1 n)) else Sum.inr ())
def extractPrivate (a : Bool) (n : ℕ) (x : Fin n → O) : Fin n → (O ⊕ Unit) :=
fun i => if p.alice i = a then Sum.inl (x i) else Sum.inr ()
def publicFrom : (n : ℕ) → (Fin n → O) → (Fin n → M)
| 0, _ => Fin.elim0
| n+1, x =>
let old := fun i : Fin n => x i.castSucc
let pubPast := publicFrom n old
Fin.snoc pubPast (if p.alice n then
p.sendA n ((p.extractPrivate true n old,pubPast),x (Fin.last n)) else
p.sendB n ((p.extractPrivate false n old,pubPast),x (Fin.last n)))
end LocalOutcomeSampler
end
section
open MeasureTheory Matrix Filter
open scoped ComplexOrder MatrixOrder
universe v4350_0 v4350_1
open scoped Matrix.Norms.L2Operator in
instance matrixMeasurableSpace {m : Type v4350_0} {n : Type v4350_1} [Fintype m] [Fintype n] :
MeasurableSpace (Matrix m n ℂ) := borel _
universe v4353_0 v4353_1
open scoped Matrix.Norms.L2Operator in
instance matrixBorelSpace {m : Type v4353_0} {n : Type v4353_1} [Fintype m] [Fintype n] :
BorelSpace (Matrix m n ℂ) := ⟨rfl⟩
universe v4357_0 v4357_1
variable {Ω : Type v4357_0} {ι : Type v4357_1} [inst4357_0 : MeasurableSpace Ω] [inst4357_1 : Fintype ι] [inst4357_2 : DecidableEq ι]
universe v4361_0 v4361_1
structure PositiveMatrixMeasure (Ω : Type v4361_0) (ι : Type v4361_1) [MeasurableSpace Ω] [Fintype ι] where
entry : ι → ι → ComplexMeasure Ω
positive : ∀ S, MeasurableSet S → Matrix.PosSemidef (fun i j => entry i j S)
namespace PositiveMatrixMeasure
def value (W : PositiveMatrixMeasure Ω ι) (S : Set Ω) : Matrix ι ι ℂ := fun i j => W.entry i j S
def density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) : Ω → Matrix ι ι ℂ :=
fun t i j => (W.entry i j).rnDeriv μ t
omit inst4357_2 in
lemma measurable_density [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) :
Measurable (W.density μ) := by
have hh : Measurable (fun t i j => (W.entry i j).rnDeriv μ t) := by
apply Measurable.of_eval; intro i
apply Measurable.of_eval; intro j
unfold ComplexMeasure.rnDeriv
simp only [Complex.mk_eq_add_mul_I]
apply Measurable.add
· exact Complex.measurable_ofReal.comp ((W.entry i j).re.measurable_rnDeriv μ)
· exact (Complex.measurable_ofReal.comp ((W.entry i j).im.measurable_rnDeriv μ)).mul_const Complex.I
have hc : Continuous (Matrix.of : (ι → ι → ℂ) → Matrix ι ι ℂ) := by
exact continuous_matrix (fun i j => continuous_apply_apply i j)
exact hc.measurable.comp hh
omit inst4357_2 in
lemma integrable_entry [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) (i j : ι) :
Integrable (fun t => W.density μ t i j) μ := (W.entry i j).integrable_rnDeriv μ
omit inst4357_2 in
lemma entry_absolutelyContinuous [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω)
(hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) (i j : ι) :
W.entry i j ≪ᵥ μ.toENNRealVectorMeasure := by
intro S hS
by_cases hs : MeasurableSet S
· have hm : μ S = 0 := by simpa [Measure.toENNRealVectorMeasure_apply,hs] using hS
exact congrArg (fun M : Matrix ι ι ℂ => M i j) (hAC S hs hm)
· exact (W.entry i j).not_measurable hs
lemma integral_density_entry (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ]
(hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0)
(S : Set Ω) (hS : MeasurableSet S) (i j : ι) :
(∫ t in S, W.density μ t i j ∂μ) = W.value S i j := by
have h := (ComplexMeasure.absolutelyContinuous_ennreal_iff _ _).mp
(W.entry_absolutelyContinuous μ hAC i j)
apply Complex.ext
· have hh := congrArg (fun s : SignedMeasure Ω => s S)
(SignedMeasure.withDensityᵥ_rnDeriv_eq (W.entry i j).re μ h.1)
rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv _ _) hS] at hh
change RCLike.re (∫ t in S, W.density μ t i j ∂μ) = _
rw [← integral_re ((W.integrable_entry μ i j).integrableOn)]
exact hh
· have hh := congrArg (fun s : SignedMeasure Ω => s S)
(SignedMeasure.withDensityᵥ_rnDeriv_eq (W.entry i j).im μ h.2)
rw [withDensityᵥ_apply (SignedMeasure.integrable_rnDeriv _ _) hS] at hh
change RCLike.im (∫ t in S, W.density μ t i j ∂μ) = _
rw [← integral_im ((W.integrable_entry μ i j).integrableOn)]
exact hh
end PositiveMatrixMeasure
lemma ae_complex_nonneg_of_integral_nonneg {μ : Measure Ω} {f : Ω → ℂ}
(hf : Integrable f μ)
(h : ∀ S, MeasurableSet S → μ S < ⊤ → 0 ≤ ∫ t in S, f t ∂μ) :
∀ᵐ t ∂μ, 0 ≤ f t := by
have hre : ∀ᵐ t ∂μ, 0 ≤ (f t).re := by
apply ae_nonneg_of_forall_setIntegral_nonneg hf.re
intro S hs hm
rw [integral_re hf.integrableOn]
exact (RCLike.nonneg_iff.mp (h S hs hm)).1
have him : (fun t => (f t).im) =ᵐ[μ] fun _ => (0:ℝ) := by
apply Integrable.ae_eq_of_forall_setIntegral_eq _ _ hf.im (integrable_zero _ _ _)
intro S hs hm
rw [integral_im hf.integrableOn]
simp only [Pi.zero_apply,integral_zero]
exact (RCLike.nonneg_iff.mp (h S hs hm)).2
filter_upwards [hre,him] with t ht hi
exact RCLike.nonneg_iff.mpr ⟨ht,hi⟩
def quadraticValue (v : ι → ℂ) (M : Matrix ι ι ℂ) : ℂ :=
∑ i, ∑ j, star (v i) * M i j * v j
omit inst4357_2 in
lemma quadraticValue_eq [DecidableEq ι] (v : ι → ℂ) (M : Matrix ι ι ℂ) :
quadraticValue v M = star v ⬝ᵥ (M *ᵥ v) := by
simp [quadraticValue,dotProduct,Matrix.mulVec,Finset.mul_sum,mul_assoc]
omit inst4357_2 in
lemma integrable_quadraticValue [DecidableEq ι] {μ : Measure Ω} {F : Ω → Matrix ι ι ℂ}
(hF : ∀ i j, Integrable (fun t => F t i j) μ) (v : ι → ℂ) :
Integrable (fun t => quadraticValue v (F t)) μ := by
apply integrable_finsetSum; intro i _
apply integrable_finsetSum; intro j _
exact ((hF i j).const_mul _).mul_const _
omit inst4357_2 in
lemma integral_quadraticValue [DecidableEq ι] {μ : Measure Ω} {F : Ω → Matrix ι ι ℂ}
(hF : ∀ i j, Integrable (fun t => F t i j) μ) (v : ι → ℂ) :
(∫ t, quadraticValue v (F t) ∂μ) = quadraticValue v (fun i j => ∫ t, F t i j ∂μ) := by
unfold quadraticValue
rw [integral_finsetSum _ (fun i _ => integrable_finsetSum _
(fun j _ => ((hF i j).const_mul _).mul_const _))]
apply Finset.sum_congr rfl; intro i _
rw [integral_finsetSum _ (fun j _ => ((hF i j).const_mul _).mul_const _)]
apply Finset.sum_congr rfl; intro j _
rw [integral_mul_const,integral_const_mul]
lemma density_posSemidef_ae (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ]
(hAC : ∀ S, MeasurableSet S → μ S = 0 → W.value S = 0) :
∀ᵐ t ∂μ, (W.density μ t).PosSemidef := by
have hherm : ∀ᵐ t ∂μ, (W.density μ t).IsHermitian := by
have hij (i j : ι) : (fun t => star (W.density μ t j i)) =ᵐ[μ]
(fun t => W.density μ t i j) := by
apply Integrable.ae_eq_of_forall_setIntegral_eq _ _
((Complex.conjCLE.integrable_comp_iff).mpr (W.integrable_entry μ j i)) (W.integrable_entry μ i j)
intro S hs hm
simp only [Complex.conjCLE_apply,integral_conj,W.integral_density_entry μ hAC S hs]
exact congrArg (fun M : Matrix ι ι ℂ => M i j) (W.positive S hs).isHermitian.eq
have hh : ∀ᵐ t ∂μ, ∀ i j, star (W.density μ t j i)=W.density μ t i j :=
ae_all_iff.mpr (fun i => ae_all_iff.mpr (hij i))
filter_upwards [hh] with t ht
exact Matrix.IsHermitian.ext ht
have hq (v : ι → ℂ) : ∀ᵐ t ∂μ, 0 ≤ quadraticValue v (W.density μ t) := by
apply ae_complex_nonneg_of_integral_nonneg
(integrable_quadraticValue (W.integrable_entry μ) v)
intro S hs hm
rw [integral_quadraticValue (fun i j => (W.integrable_entry μ i j).integrableOn)]
simp only [W.integral_density_entry μ hAC S hs]
change 0 ≤ quadraticValue v (W.value S)
rw [quadraticValue_eq]
exact (W.positive S hs).dotProduct_mulVec_nonneg v
obtain ⟨s,hs,hd⟩ := TopologicalSpace.exists_countable_dense (ι → ℂ)
let : Countable s := hs.to_subtype
have hqs : ∀ᵐ t ∂μ, ∀ v : s, 0 ≤ quadraticValue v (W.density μ t) :=
ae_all_iff.mpr (fun v => hq v)
filter_upwards [hherm,hqs] with t ht hqt
apply Matrix.posSemidef_iff_dotProduct_mulVec.mpr
refine ⟨ht,fun v => ?_⟩
rw [← quadraticValue_eq]
refine hd.denseRange_val.induction_on (p := fun v => 0 ≤ quadraticValue v (W.density μ t)) v ?_ hqt
· apply isClosed_le continuous_const
unfold quadraticValue
fun_prop
end
section
open MeasureTheory Matrix Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ProbabilityTheory ENNReal NNReal Topology
universe v4526_0
lemma psd_entry_norm_le_trace {ι : Type v4526_0} [inst4526_0 : Fintype ι]
[inst4526_1 : DecidableEq ι]
{M : Matrix ι ι ℂ} (hM : M.PosSemidef) (i j : ι) :
‖M i j‖ ≤ (trace M).re := by
let S := CFC.sqrt M
have hS : S.IsHermitian := (CFC.sqrt_nonneg M).isSelfAdjoint.isHermitian
have hSS : S * Sᴴ = M := by rw [hS.eq]; exact CFC.sqrt_mul_sqrt_self M hM.nonneg
let v (i : ι) : EuclideanSpace ℂ ι := WithLp.toLp 2 (fun k => S i k)
have he (i j : ι) : M i j = inner ℂ (v j) (v i) := by
rw [← hSS]
simp [v,Matrix.mul_apply,EuclideanSpace.inner_toLp_toLp,dotProduct]
have hv (i : ι) : ‖v i‖ = Real.sqrt (M i i).re := by
rw [he]; exact norm_eq_sqrt_re_inner (𝕜 := ℂ) (v i)
have hdiag (i : ι) : (M i i).re ≤ (trace M).re := by
change (M i i).re ≤ (∑ k, M k k).re
rw [Complex.re_sum]
exact Finset.single_le_sum (fun k _ => (RCLike.nonneg_iff.mp (hM.diag_nonneg (i:=k))).1) (Finset.mem_univ i)
have ht : 0 ≤ (trace M).re := (RCLike.nonneg_iff.mp hM.trace_nonneg).1
calc
‖M i j‖ ≤ ‖v j‖ * ‖v i‖ := by rw [he]; exact norm_inner_le_norm _ _
_ ≤ Real.sqrt (trace M).re * Real.sqrt (trace M).re := by
rw [hv,hv]
exact mul_le_mul (Real.sqrt_le_sqrt (hdiag j)) (Real.sqrt_le_sqrt (hdiag i))
(Real.sqrt_nonneg _) (Real.sqrt_nonneg _)
_ = (trace M).re := Real.mul_self_sqrt ht
universe v4553_0
lemma uniformIntegrable_of_ae_norm_le_one {Ω : Type v4553_0} {mΩ : MeasurableSpace Ω}
{μ : Measure Ω} [inst4553_0 : IsFiniteMeasure μ]
{f : ℕ → Ω → ℝ}
(hf : ∀ n, AEStronglyMeasurable (f n) μ) (hb : ∀ n, ∀ᵐ ω ∂μ, ‖f n ω‖ ≤ 1) :
UniformIntegrable f 1 μ := by
apply uniformIntegrable_of le_rfl ENNReal.one_ne_top hf
intro ε hε
refine ⟨2, fun n => ?_⟩
have hz : ({ω | (2:ℝ≥0) ≤ ‖f n ω‖₊}.indicator (f n)) =ᵐ[μ] 0 := by
filter_upwards [hb n] with ω hω
rw [Set.indicator_of_notMem]
· rfl
· simp only [Set.mem_ofPred_eq,not_le]
have : ‖f n ω‖₊ ≤ (1:ℝ≥0) := hω
exact lt_of_le_of_lt this (by norm_num)
rw [eLpNorm_congr_ae hz,eLpNorm_zero]
exact bot_le
lemma bounded_martingale_limit {Ω : Type v4553_0} {mΩ : MeasurableSpace Ω} {μ : Measure Ω}
[inst4553_0 : IsFiniteMeasure μ] {F : Filtration ℕ mΩ}
{f : ℕ → Ω → ℝ} (hf : Martingale f F μ)
(hb : ∀ n, ∀ᵐ ω ∂μ, ‖f n ω‖ ≤ 1) :
∃ g : Ω → ℝ, Integrable g μ ∧
(∀ᵐ ω ∂μ, Tendsto (fun n => f n ω) atTop (𝓝 (g ω))) ∧
(∀ n, f n =ᵐ[μ] μ[g | F n]) := by
have hui := uniformIntegrable_of_ae_norm_le_one
(fun n => ((hf.stronglyMeasurable n).mono (F.le n)).aestronglyMeasurable) hb
refine ⟨F.limitProcess f μ, ?_, hf.submartingale.ae_tendsto_limitProcess_of_uniformIntegrable hui,
hf.ae_eq_condExp_limitProcess hui⟩
obtain ⟨R,hR⟩ := hui.2
exact (hf.submartingale.memLp_limitProcess hR).integrable le_rfl
universe v4584_0 v4584_1
variable {Ω : Type v4584_0} {ι : Type v4584_1} [inst4584_0 : MeasurableSpace Ω] [inst4584_1 : Fintype ι] [inst4584_2 : DecidableEq ι]
{μ : Measure Ω} {G : Ω → Matrix ι ι ℂ}
lemma integrable_matrix_of_entries (hG : ∀ i j, Integrable (fun ω => G ω i j) μ) :
Integrable G μ := by
have h : Integrable (fun ω i j => G ω i j) μ :=
integrable_pi_iff.mpr (fun i => integrable_pi_iff.mpr (hG i))
let L : (ι → ι → ℂ) →L[ℂ] Matrix ι ι ℂ :=
LinearMap.toContinuousLinearMap (Matrix.ofLinearEquiv ℂ).toLinearMap
exact L.integrable_comp h
lemma integral_matrix_entry (hG : Integrable G μ) (i j : ι) :
(∫ ω, G ω ∂μ) i j = ∫ ω, G ω i j ∂μ := by
let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap
exact (L.integral_comp_comm hG).symm
def positiveMatrixMeasureOfDensity (hG : ∀ i j, Integrable (fun ω => G ω i j) μ)
(hp : ∀ᵐ ω ∂μ, (G ω).PosSemidef) : PositiveMatrixMeasure Ω ι where
entry i j := μ.withDensityᵥ (fun ω => G ω i j)
positive S hS := by
have he : (fun i j => μ.withDensityᵥ (fun ω => G ω i j) S) = ∫ ω in S, G ω ∂μ := by
ext i j
rw [withDensityᵥ_apply (hG i j) hS,
integral_matrix_entry (integrable_matrix_of_entries hG).integrableOn]
rw [he]
exact (integral_nonneg_of_ae ((ae_restrict_of_ae hp).mono (fun _ h => h.nonneg))).posSemidef
lemma positiveMatrixMeasureOfDensity_value
(hG : ∀ i j, Integrable (fun ω => G ω i j) μ)
(hp : ∀ᵐ ω ∂μ, (G ω).PosSemidef) (S : Set Ω) (hS : MeasurableSet S) :
(positiveMatrixMeasureOfDensity hG hp).value S = ∫ ω in S, G ω ∂μ := by
ext i j
change μ.withDensityᵥ (fun ω => G ω i j) S = _
rw [withDensityᵥ_apply (hG i j) hS,
integral_matrix_entry (integrable_matrix_of_entries hG).integrableOn]
end
section
open scoped ComplexOrder MatrixOrder Kronecker
open Matrix
universe v4714_0 v4714_1 v4714_2
variable {ι : Type v4714_0} {κ : Type v4714_1} {η : Type v4714_2} [inst4714_0 : Fintype ι] [inst4714_1 : Fintype κ] [inst4714_2 : Fintype η]
[inst4714_3 : DecidableEq ι] [inst4714_4 : DecidableEq κ] [inst4714_5 : DecidableEq η]
def keepReference (U : Matrix (ι × η) (ι × η) ℂ) : Matrix η η ℂ :=
fun x y => ∑ i, U (i,x) (i,y)
def referenceFilter (K : Matrix κ η ℂ) (U : Matrix (ι × η) (ι × η) ℂ) :
Matrix (ι × κ) (ι × κ) ℂ :=
((1 : Matrix ι ι ℂ) ⊗ₖ K) * U * ((1 : Matrix ι ι ℂ) ⊗ₖ K)ᴴ
omit inst4714_1 inst4714_4 inst4714_5 in
lemma referenceFilter_apply [Fintype κ] [DecidableEq κ] [DecidableEq η] (K : Matrix κ η ℂ) (U : Matrix (ι × η) (ι × η) ℂ)
(i j : ι) (x y : κ) :
referenceFilter K U (i,x) (j,y) = ∑ s, ∑ t, K x s * U (i,s) (j,t) * star (K y t) := by
simp only [referenceFilter,Matrix.conjTranspose_kronecker,Matrix.conjTranspose_one]
simp [Matrix.mul_apply,Fintype.sum_prod_type,Matrix.one_apply,
Matrix.conjTranspose_apply,Finset.sum_mul]
rw [Finset.sum_comm]
lemma keepReference_filter (K : Matrix κ η ℂ) (U : Matrix (ι × η) (ι × η) ℂ) :
keepReference (referenceFilter K U) = K * keepReference U * Kᴴ := by
ext x y
simp only [keepReference,referenceFilter_apply,Matrix.mul_apply,Matrix.conjTranspose_apply]
simp_rw [Finset.mul_sum,Finset.sum_mul]
conv_rhs => rw [Finset.sum_comm]
rw [Finset.sum_comm]
apply Finset.sum_congr rfl; intro s _
rw [Finset.sum_comm]
def vectorize (S : Matrix ι η ℂ) : ι × η → ℂ := fun p => S p.1 p.2
omit inst4714_2 inst4714_3 inst4714_5 in
lemma keepReference_vectorize [Fintype η] [DecidableEq ι] [DecidableEq η] (S : Matrix ι η ℂ) :
keepReference (outer (vectorize S) (vectorize S)) = (Sᴴ*S)ᵀ := by
ext x y
simp only [keepReference,outer,vectorize,Matrix.transpose_apply,Matrix.mul_apply,
Matrix.conjTranspose_apply]
apply Finset.sum_congr rfl; intro i _; ring
lemma referenceFilter_vectorize (K : Matrix κ η ℂ) (S : Matrix ι η ℂ) :
referenceFilter K (outer (vectorize S) (vectorize S)) =
outer (vectorize (S*Kᵀ)) (vectorize (S*Kᵀ)) := by
ext ⟨i,x⟩ ⟨j,y⟩
rw [referenceFilter_apply]
simp only [outer,vectorize,Matrix.mul_apply,Matrix.transpose_apply,star_sum,star_mul]
simp_rw [Finset.mul_sum,Finset.sum_mul]
conv_rhs => rw [Finset.sum_comm]
apply Finset.sum_congr rfl; intro s _
apply Finset.sum_congr rfl; intro t _
ring
def localProbe : ι × ι → ℂ :=
vectorize (((Real.sqrt (Fintype.card ι : ℝ))⁻¹ : ℂ) • (1 : Matrix ι ι ℂ))
def canonicalPurification (R : Matrix ι ι ℂ) : ι × ι → ℂ := vectorize (CFC.sqrt R)
def preparationFilter (R : Matrix ι ι ℂ) : Matrix ι ι ℂ :=
(Real.sqrt (Fintype.card ι : ℝ) : ℂ) • (CFC.sqrt R)ᵀ
lemma preparation_filter_identity [Nonempty ι] (R : Matrix ι ι ℂ) :
referenceFilter (preparationFilter R) (outer (localProbe (ι := ι)) localProbe) =
outer (canonicalPurification R) (canonicalPurification R) := by
unfold localProbe canonicalPurification preparationFilter
rw [referenceFilter_vectorize,Matrix.transpose_smul,Matrix.transpose_transpose,
Matrix.smul_mul,Matrix.mul_smul,one_mul,smul_smul]
have hc : (Real.sqrt (Fintype.card ι : ℝ) : ℂ) ≠ 0 := by
exact Complex.ofReal_ne_zero.mpr (Real.sqrt_pos.mpr (by exact_mod_cast Fintype.card_pos)).ne'
rw [inv_mul_cancel₀ hc,one_smul]
lemma canonical_reference (R : Matrix ι ι ℂ) (hR : R.PosSemidef) :
keepReference (outer (canonicalPurification R) (canonicalPurification R)) = Rᵀ := by
rw [canonicalPurification,keepReference_vectorize,
(CFC.sqrt_nonneg R).posSemidef.isHermitian.eq,CFC.sqrt_mul_sqrt_self R hR.nonneg]
end
namespace PositiveMatrixMeasure
section
open MeasureTheory Matrix Filter
open scoped ComplexOrder MatrixOrder
universe v4860_0 v4860_1
variable {Ω : Type v4860_0} {ι : Type v4860_1} [inst4860_0 : MeasurableSpace Ω] [inst4860_1 : Fintype ι] [inst4860_2 : DecidableEq ι]
def traceSigned (W : PositiveMatrixMeasure Ω ι) : SignedMeasure Ω :=
∑ i, (W.entry i i).re
omit inst4860_2 in
lemma traceSigned_apply [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (S : Set Ω) :
W.traceSigned S = (trace (W.value S)).re := by
simp [traceSigned,trace,value,ComplexMeasure.re_apply]
apply Finset.sum_congr rfl; intro i _; rfl
lemma traceSigned_nonneg (W : PositiveMatrixMeasure Ω ι) :
(0 : SignedMeasure Ω) ≤[Set.univ] W.traceSigned := by
simpa only [VectorMeasure.restrict_univ] using (show (0 : SignedMeasure Ω) ≤ W.traceSigned from by
intro S hS
change 0 ≤ W.traceSigned S
rw [traceSigned_apply]
have hh : (0:ℂ) ≤ trace (W.value S) := (W.positive S hS).trace_nonneg
exact (RCLike.nonneg_iff.mp hh).1)
def traceMeasure (W : PositiveMatrixMeasure Ω ι) : Measure Ω :=
W.traceSigned.toMeasureOfZeroLE Set.univ MeasurableSet.univ (by
simpa only [VectorMeasure.restrict_univ] using
(show (0 : SignedMeasure Ω) ≤ W.traceSigned from by
intro S hS
have htrace : W.traceSigned S = (trace (W.value S)).re := by
simp [traceSigned, trace, value, ComplexMeasure.re_apply]
apply Finset.sum_congr rfl
intro i _
rfl
change 0 ≤ W.traceSigned S
rw [htrace]
exact (RCLike.nonneg_iff.mp (W.positive S hS).trace_nonneg).1))
instance traceMeasure_finite (W : PositiveMatrixMeasure Ω ι) : IsFiniteMeasure W.traceMeasure :=
inferInstanceAs (IsFiniteMeasure (W.traceSigned.toMeasureOfZeroLE Set.univ
MeasurableSet.univ W.traceSigned_nonneg))
lemma integrable_trace_density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) :
Integrable (fun t => trace (W.density μ t)) μ := by
exact integrable_finsetSum _ (fun i _ => W.integrable_entry μ i i)
lemma integral_trace_density (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ]
(hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0)
(S : Set Ω) (hS : MeasurableSet S) :
(∫ t in S, trace (W.density μ t) ∂μ) = trace (W.value S) := by
unfold trace diag
rw [integral_finsetSum _ (fun i _ => (W.integrable_entry μ i i).integrableOn)]
apply Finset.sum_congr rfl; intro i _
exact W.integral_density_entry μ hAC S hS i i
universe v4989_0
def filter {κ : Type v4989_0} [Fintype κ] (W : PositiveMatrixMeasure Ω ι) (K : Matrix κ ι ℂ) :
PositiveMatrixMeasure Ω κ where
entry x y := ∑ i, ∑ j, (K x i * star (K y j)) • W.entry i j
positive S hS := by
have he : (fun x y => (∑ i, ∑ j, (K x i * star (K y j)) • W.entry i j) S) =
K * W.value S * Kᴴ := by
ext x y
simp only [_root_.sum_apply,_root_.smul_apply,Matrix.mul_apply,
Matrix.conjTranspose_apply,smul_eq_mul,Finset.sum_mul]
rw [Finset.sum_comm]
apply Finset.sum_congr rfl; intro i _
apply Finset.sum_congr rfl; intro j _
dsimp [value]
ring
rw [he]
exact (W.positive S hS).mul_mul_conjTranspose_same K
universe v5006_0
omit inst4860_2 in
lemma filter_value [DecidableEq ι] {κ : Type v5006_0} [Fintype κ] (W : PositiveMatrixMeasure Ω ι)
(K : Matrix κ ι ℂ) (S : Set Ω) : (W.filter K).value S = K * W.value S * Kᴴ := by
ext x y
simp only [filter,value,_root_.sum_apply,_root_.smul_apply,Matrix.mul_apply,
Matrix.conjTranspose_apply,smul_eq_mul,Finset.sum_mul]
rw [Finset.sum_comm]
apply Finset.sum_congr rfl; intro i _
apply Finset.sum_congr rfl; intro j _
ring
end
open Matrix MeasureTheory
open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator
universe v5077_0 v5077_1 v5077_2
variable {O : Type v5077_0} {ι : Type v5077_1} {η : Type v5077_2} [inst5077_0 : MeasurableSpace O] [inst5077_1 : Fintype ι] [inst5077_2 : Fintype η]
[inst5077_3 : DecidableEq ι] [inst5077_4 : DecidableEq η]
universe v5098_0
def pushforward {T : Type v5098_0} [MeasurableSpace T] (W : PositiveMatrixMeasure O η)
(f : O → T) (hf : Measurable f) : PositiveMatrixMeasure T η where
entry i j := (W.entry i j).map f
positive S hS := by
simpa only [VectorMeasure.map_apply _ hf hS] using W.positive (f ⁻¹' S) (hf hS)
universe v5104_0
omit inst5077_4 in
lemma pushforward_value [DecidableEq η] {T : Type v5104_0} [MeasurableSpace T] (W : PositiveMatrixMeasure O η)
(f : O → T) (hf : Measurable f) (S : Set T) (hS : MeasurableSet S) :
(W.pushforward f hf).value S = W.value (f ⁻¹' S) := by
ext i j; exact VectorMeasure.map_apply _ hf hS
end PositiveMatrixMeasure
section
open Matrix MeasureTheory ProbabilityTheory Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator
universe v5273_0
variable {O : Type v5273_0} [inst5273_0 : MeasurableSpace O]
def historyPrefix (n : ℕ) (x : ℕ → O) : Fin n → O := fun i => x i
lemma measurable_historyPrefix (n : ℕ) : Measurable (historyPrefix (O := O) n) := by
unfold historyPrefix
fun_prop
def historyFiltration : Filtration ℕ (inferInstance : MeasurableSpace (ℕ → O)) where
seq n := MeasurableSpace.comap (historyPrefix n) inferInstance
mono' := by
intro n k hnk
apply MeasurableSpace.comap_le_iff_le_map.mpr
intro S hS
change MeasurableSet[MeasurableSpace.comap (historyPrefix k) inferInstance]
(historyPrefix n ⁻¹' S)
refine ⟨(fun s : Fin k → O => fun i : Fin n => s (Fin.castLE hnk i)) ⁻¹' S,
(show Measurable (fun s : Fin k → O => fun i : Fin n => s (Fin.castLE hnk i)) by fun_prop) hS,?_⟩
rfl
le' n := (show Measurable (historyPrefix (O := O) n) by unfold historyPrefix; fun_prop).comap_le
lemma historyPrefix_adapted (n : ℕ) :
Measurable[(historyFiltration (O := O)) n] (historyPrefix (O := O) n) :=
Measurable.of_comap_le le_rfl
lemma historyFiltration_generates :
(inferInstance : MeasurableSpace (ℕ → O)) = ⨆ n, historyFiltration (O := O) n := by
apply le_antisymm
· change (⨆ k : ℕ, MeasurableSpace.comap (fun x : ℕ → O => x k) inferInstance) ≤ _
apply iSup_le
intro k
apply le_iSup_of_le (k+1)
have hk := (measurable_pi_apply (⟨k,Nat.lt_succ_self k⟩ : Fin (k+1))).comp
(historyPrefix_adapted (O := O) (k+1))
exact hk.comap_le
· exact iSup_le (fun n => (historyFiltration (O := O)).le n)
universe v5311_0
variable {ι : Type v5311_0} [inst5311_0 : Fintype ι] [inst5311_1 : DecidableEq ι]
universe v5313_0
lemma density_entry_bound {Ω : Type v5313_0} [MeasurableSpace Ω]
(U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Density (U x)) (i j : ι) (x : Ω) :
‖U x i j‖ ≤ 1 := by
have h := psd_entry_norm_le_trace (hU x).1 i j
simpa only [(hU x).2,Complex.one_re] using h
universe v5319_0
lemma integrable_density_entry {Ω : Type v5319_0} [MeasurableSpace Ω]
(U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Density (U x)) (hm : Measurable U)
(μ : Measure Ω) [IsFiniteMeasure μ] (i j : ι) :
Integrable (fun x => U x i j) μ := by
let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap
exact Integrable.of_bound (L.continuous.measurable.comp hm).aestronglyMeasurable 1
(Filter.Eventually.of_forall (density_entry_bound U hU i j))
variable (P : Measure (ℕ → O)) [inst5327_0 : IsProbabilityMeasure P]
(K : (n : ℕ) → Kernel (Fin n → O) O) [inst5327_1 : ∀ n, IsMarkovKernel (K n)]
(hP : ∀ n, P.map (historyPrefix (n+1)) =
((P.map (historyPrefix n)) ⊗ₘ K n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2))
(U : (n : ℕ) → (Fin n → O) → Matrix ι ι ℂ)
(hU : ∀ n s, Density (U n s)) (hm : ∀ n, Measurable (U n))
(hmean : ∀ n s i j,
(∫ o, U (n+1) (Fin.snoc (α := fun _ : Fin (n+1) => O) s o) i j ∂K n s) = U n s i j)
include hP hU hm hmean in
lemma reference_history_step_integral (n : ℕ) (S : Set (ℕ → O))
(hS : MeasurableSet[historyFiltration n] S) (i j : ι) :
(∫ x in S, U (n+1) (historyPrefix (n+1) x) i j ∂P) =
∫ x in S, U n (historyPrefix n x) i j ∂P := by
classical
obtain ⟨A,hA,rfl⟩ := hS
let r : (Fin (n+1) → O) → (Fin n → O) := fun s i => s i.castSucc
have hr : Measurable r := by fun_prop
let snoc : (Fin n → O) × O → (Fin (n+1) → O) := fun s => Fin.snoc s.1 s.2
have hs : Measurable snoc := by
apply Measurable.of_eval
intro i
refine Fin.lastCases ?_ (fun j => ?_) i
· simpa [snoc] using measurable_snd
· simpa only [snoc, Fin.snoc_castSucc, Function.comp_def] using ((measurable_pi_apply j).comp measurable_fst)
let f : (Fin (n+1) → O) → ℂ := (r ⁻¹' A).indicator (fun s => U (n+1) s i j)
let g : (Fin n → O) → ℂ := A.indicator (fun s => U n s i j)
let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap
have hf : Measurable f := (L.continuous.measurable.comp (hm (n+1))).indicator (hr hA)
have hg : Measurable g := (L.continuous.measurable.comp (hm n)).indicator hA
have hfi : Integrable (fun s => f (snoc s)) ((P.map (historyPrefix n)) ⊗ₘ K n) := by
apply Integrable.of_bound (hf.comp hs).aestronglyMeasurable 1
apply Filter.Eventually.of_forall
intro s
exact (norm_indicator_le_norm_self (s := r ⁻¹' A) (fun t => U (n+1) t i j) (snoc s)).trans (density_entry_bound (U (n+1)) (hU (n+1)) i j _)
have he (s : Fin n → O) : (∫ o, f (snoc (s,o)) ∂K n s) = g s := by
have hh (o : O) : f (snoc (s,o)) =
if s ∈ A then U (n+1) (Fin.snoc s o) i j else 0 := by
simp only [f,Set.indicator,Set.mem_preimage,r,snoc]
have ht : (fun i : Fin n => Fin.snoc (α := fun _ : Fin (n+1) => O) s o i.castSucc) = s := by
ext i; simp
rw [ht]
simp_rw [hh]
by_cases h : s ∈ A
· simp only [h,ite_true,g,Set.indicator_of_mem]
exact hmean n s i j
· simp [h,g]
calc
_ = ∫ x, f (historyPrefix (n+1) x) ∂P := by
rw [← integral_indicator ((measurable_historyPrefix n) hA)]
congr 1
_ = ∫ s, f s ∂P.map (historyPrefix (n+1)) :=
(integral_map (measurable_historyPrefix _).aemeasurable hf.aestronglyMeasurable).symm
_ = ∫ s, f s ∂(((P.map (historyPrefix n)) ⊗ₘ K n).map snoc) := by rw [hP n]
_ = ∫ s, f (snoc s) ∂((P.map (historyPrefix n)) ⊗ₘ K n) :=
integral_map hs.aemeasurable hf.aestronglyMeasurable
_ = ∫ s, ∫ o, f (snoc (s,o)) ∂K n s ∂P.map (historyPrefix n) :=
MeasureTheory.Measure.integral_compProd hfi
_ = ∫ s, g s ∂P.map (historyPrefix n) := by simp_rw [he]
_ = ∫ x, g (historyPrefix n x) ∂P :=
integral_map (measurable_historyPrefix n).aemeasurable hg.aestronglyMeasurable
_ = _ := by
rw [← integral_indicator ((measurable_historyPrefix n) hA)]
rfl
include hP hU hm hmean in
lemma reference_history_integral (n k : ℕ) (hnk : n ≤ k) (S : Set (ℕ → O))
(hS : MeasurableSet[historyFiltration n] S) (i j : ι) :
(∫ x in S, U k (historyPrefix k x) i j ∂P) =
∫ x in S, U n (historyPrefix n x) i j ∂P := by
induction k, hnk using Nat.le_induction with
| base => rfl
| succ k hnk ih =>
rw [reference_history_step_integral P K hP U hU hm hmean k S
(((historyFiltration (O := O)).mono hnk) S hS) i j]
exact ih
omit inst5311_1 in
lemma reference_history_measurable [DecidableEq ι] (n : ℕ) (i j : ι) (hm : ∀ n, Measurable (U n)) :
Measurable[historyFiltration n] (fun x => U n (historyPrefix n x) i j) := by
let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap
exact L.continuous.measurable.comp ((hm n).comp (historyPrefix_adapted n))
lemma reference_history_integrable (n : ℕ) (i j : ι) (hU : ∀ n s, Density (U n s))
(hm : ∀ n, Measurable (U n)) :
Integrable (fun x => U n (historyPrefix n x) i j) P := by
exact integrable_density_entry (fun x => U n (historyPrefix n x))
(fun x => hU n _) ((hm n).comp (measurable_historyPrefix n)) P i j
include hP hU hm hmean in
lemma reference_history_martingale_re (i j : ι) :
Martingale (fun n x => (U n (historyPrefix n x) i j).re) historyFiltration P := by
refine ⟨fun n => ((reference_history_measurable U n i j hm).re).stronglyMeasurable, ?_⟩
intro n k hnk
symm
apply ae_eq_condExp_of_forall_setIntegral_eq (historyFiltration.le n)
((reference_history_integrable P U k i j hU hm).re)
· intro S _ _
exact (reference_history_integrable P U n i j hU hm).re.integrableOn
· intro S hS _
change (∫ x in S, RCLike.re (U n (historyPrefix n x) i j) ∂P) = _
rw [integral_re (reference_history_integrable P U n i j hU hm).integrableOn,
integral_re (reference_history_integrable P U k i j hU hm).integrableOn,
reference_history_integral P K hP U hU hm hmean n k hnk S hS i j]
· exact ((reference_history_measurable U n i j hm).re).stronglyMeasurable.aestronglyMeasurable
include hP hU hm hmean in
lemma reference_history_martingale_im (i j : ι) :
Martingale (fun n x => (U n (historyPrefix n x) i j).im) historyFiltration P := by
refine ⟨fun n => ((reference_history_measurable U n i j hm).im).stronglyMeasurable, ?_⟩
intro n k hnk
symm
apply ae_eq_condExp_of_forall_setIntegral_eq (historyFiltration.le n)
((reference_history_integrable P U k i j hU hm).im)
· intro S _ _
exact (reference_history_integrable P U n i j hU hm).im.integrableOn
· intro S hS _
change (∫ x in S, RCLike.im (U n (historyPrefix n x) i j) ∂P) = _
rw [integral_im (reference_history_integrable P U n i j hU hm).integrableOn,
integral_im (reference_history_integrable P U k i j hU hm).integrableOn,
reference_history_integral P K hP U hU hm hmean n k hnk S hS i j]
· exact ((reference_history_measurable U n i j hm).im).stronglyMeasurable.aestronglyMeasurable
end
open MeasureTheory ProbabilityTheory Matrix Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Topology
universe v5486_0 v5486_1
variable {Ω : Type v5486_0} {ι : Type v5486_1} {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω}
[inst5486_0 : Fintype ι] [inst5486_1 : DecidableEq ι] {μ : Measure Ω} [inst5486_2 : IsFiniteMeasure μ]
{F : Filtration ℕ mΩ}
theorem local_reference_limit
(W : ℕ → Ω → Matrix ι ι ℂ)
(hW : ∀ n x, Density (W n x))
(hlocal : ∀ n, Measurable[L] (W n))
(hL : L ≤ mΩ)
(hr : ∀ i j, Martingale (fun n x => (W n x i j).re) F μ)
(hi : ∀ i j, Martingale (fun n x => (W n x i j).im) F μ) :
∃ G : Ω → Matrix ι ι ℂ,
Measurable[L] G ∧ (∀ x, Density (G x)) ∧
(∀ i j, Integrable (fun x => G x i j) μ) ∧
(∀ᵐ x ∂μ, Tendsto (fun n => W n x) atTop (𝓝 (G x))) ∧
(∀ n S, MeasurableSet[F n] S →
(∫ x in S, G x ∂μ) = ∫ x in S, W n x ∂μ) := by
classical
have hbound (n : ℕ) (i j : ι) (x : Ω) : ‖W n x i j‖ ≤ 1 := by
simpa only [(hW n x).2, Complex.one_re] using
psd_entry_norm_le_trace (hW n x).1 i j
have hbr (i j : ι) (n : ℕ) : ∀ᵐ x ∂μ, ‖(W n x i j).re‖ ≤ 1 :=
Filter.Eventually.of_forall (fun x =>
(show ‖(W n x i j).re‖ ≤ ‖W n x i j‖ from by
simpa only [Real.norm_eq_abs] using Complex.abs_re_le_norm (W n x i j)).trans
(hbound n i j x))
have hbi (i j : ι) (n : ℕ) : ∀ᵐ x ∂μ, ‖(W n x i j).im‖ ≤ 1 :=
Filter.Eventually.of_forall (fun x =>
(show ‖(W n x i j).im‖ ≤ ‖W n x i j‖ from by
simpa only [Real.norm_eq_abs] using Complex.abs_im_le_norm (W n x i j)).trans
(hbound n i j x))
choose gr hgr htr hcr using (fun i j => bounded_martingale_limit (hr i j) (hbr i j))
choose gi hgi hti hci using (fun i j => bounded_martingale_limit (hi i j) (hbi i j))
let H : Ω → Matrix ι ι ℂ := fun x i j => (gr i j x : ℂ) + (gi i j x : ℂ)*Complex.I
have hH (i j : ι) : Integrable (fun x => H x i j) μ :=
((hgr i j).ofReal).add (((hgi i j).ofReal).mul_const Complex.I)
have hlimH : ∀ᵐ x ∂μ, Tendsto (fun n => W n x) atTop (𝓝 (H x)) := by
have htr' := ae_all_iff.mpr (fun i => ae_all_iff.mpr (htr i))
have hti' := ae_all_iff.mpr (fun i => ae_all_iff.mpr (hti i))
filter_upwards [htr', hti'] with x hx hy
have hc : Tendsto (fun n i j => W n x i j) atTop (𝓝 (fun i j => H x i j)) := by
apply tendsto_pi_nhds.mpr; intro i
apply tendsto_pi_nhds.mpr; intro j
have hh := (Complex.continuous_ofReal.continuousAt.tendsto.comp (hx i j)).add
((Complex.continuous_ofReal.continuousAt.tendsto.comp (hy i j)).mul_const Complex.I)
simpa only [Function.comp_apply, Pi.add_apply, Complex.re_add_im] using hh
have hcM : Continuous (Matrix.of : (ι → ι → ℂ) → Matrix ι ι ℂ) :=
continuous_matrix (fun i j => continuous_apply_apply i j)
exact hcM.continuousAt.tendsto.comp hc
let raw : Ω → Matrix ι ι ℂ := fun x => limUnder atTop (fun n => W n x)
have hraw : Measurable[L] raw :=
(@StronglyMeasurable.limUnder ℕ Ω (Matrix ι ι ℂ) L _ _ atTop _ _ _ _
(fun n => (hlocal n).stronglyMeasurable)).measurable
have hgood : MeasurableSet[L] {x | 0 ≤ raw x ∧ trace (raw x) = 1} := by
exact (measurableSet_le measurable_const hraw).inter
(measurableSet_eq_fun ((Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap.continuous.measurable.comp hraw) measurable_const)
let G : Ω → Matrix ι ι ℂ := fun x =>
if 0 ≤ raw x ∧ trace (raw x) = 1 then raw x else W 0 x
have hGm : Measurable[L] G := hraw.ite hgood (hlocal 0)
have hGp (x : Ω) : Density (G x) := by
dsimp [G]
split
· rename_i h
exact ⟨h.1.posSemidef, h.2⟩
· exact hW 0 x
have hGH : G =ᵐ[μ] H := by
filter_upwards [hlimH] with x hx
have hrx : raw x = H x := hx.limUnder_eq
have hp : 0 ≤ H x :=
isClosed_Ici.mem_of_tendsto hx (Eventually.of_forall (fun n => (hW n x).1.nonneg))
have ht : trace (H x) = 1 := by
have htend := (Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap.continuous.continuousAt.tendsto.comp hx
have he : (fun n => trace (W n x)) = fun _ => (1 : ℂ) := funext (fun n => (hW n x).2)
change Tendsto (fun n => trace (W n x)) atTop (𝓝 (trace (H x))) at htend
rw [he] at htend
exact tendsto_nhds_unique htend tendsto_const_nhds
simp only [G, hrx, hp, ht, and_self, ↓reduceIte]
have hGi (i j : ι) : Integrable (fun x => G x i j) μ :=
(hH i j).congr (hGH.mono (fun x hx => congrArg (fun M => M i j) hx.symm))
refine ⟨G,hGm,hGp,hGi,?_,?_⟩
· filter_upwards [hlimH,hGH] with x hx he
simpa only [he] using hx
· intro n S hS
have hc (i j : ι) : Integrable (fun x => W n x i j) μ :=
Integrable.of_bound (((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).measurable.comp
((hlocal n).mono hL le_rfl)).aestronglyMeasurable 1
(Eventually.of_forall (hbound n i j))
ext i j
rw [integral_matrix_entry (integrable_matrix_of_entries hGi).integrableOn,
integral_matrix_entry (integrable_matrix_of_entries hc).integrableOn]
calc
_ = ∫ x in S, H x i j ∂μ := integral_congr_ae
(ae_restrict_of_ae (hGH.mono (fun x hx => congrArg (fun M => M i j) hx)))
_ = ∫ x in S, W n x i j ∂μ := by
apply Complex.ext
· change RCLike.re (∫ x in S, H x i j ∂μ) = RCLike.re (∫ x in S, W n x i j ∂μ)
rw [← integral_re (hH i j).integrableOn, ← integral_re (hc i j).integrableOn]
have heH : (fun x => RCLike.re (H x i j)) = gr i j := by
funext x; simp [H]
rw [heH, ← setIntegral_condExp (F.le n) (hgr i j) hS]
exact integral_congr_ae (ae_restrict_of_ae (hcr i j n).symm)
· change RCLike.im (∫ x in S, H x i j ∂μ) = RCLike.im (∫ x in S, W n x i j ∂μ)
rw [← integral_im (hH i j).integrableOn, ← integral_im (hc i j).integrableOn]
have heH : (fun x => RCLike.im (H x i j)) = gi i j := by
funext x; simp [H]
rw [heH, ← setIntegral_condExp (F.le n) (hgi i j) hS]
exact integral_congr_ae (ae_restrict_of_ae (hci i j n).symm)
end ZeroKey
namespace UnrestrictedQuantum
open Matrix MeasureTheory ProbabilityTheory
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
universe v5616_0 v5616_1
abbrev LocalHistory (O : Type v5616_0) (M : Type v5616_1) (n : ℕ) :=
(Fin n → (O ⊕ Unit)) × (Fin n → M)
universe v5619_0 v5619_1
def localActive {O : Type v5619_0} {M : Type v5619_1} {n : ℕ} (h : LocalHistory O M n) (o : O) (m : M) :
LocalHistory O M (n+1) :=
(Fin.snoc h.1 (Sum.inl o), Fin.snoc h.2 m)
universe v5623_0 v5623_1
def localPassive {O : Type v5623_0} {M : Type v5623_1} {n : ℕ} (h : LocalHistory O M n) (m : M) :
LocalHistory O M (n+1) :=
(Fin.snoc h.1 (Sum.inr ()), Fin.snoc h.2 m)
universe v5628_0 v5628_1 v5628_2 v5628_3
variable {O : Type v5628_0} {M : Type v5628_1} {ι : Type v5628_2} [inst5628_0 : MeasurableSpace O] [inst5628_1 : MeasurableSpace M]
[inst5628_2 : Fintype ι] [inst5628_3 : DecidableEq ι]
(A : ℕ → Type v5628_3) [inst5628_4 : ∀ n, AddCommGroup (A n)] [inst5628_5 : ∀ n, Module ℂ (A n)]
[inst5628_6 : ∀ n, One (A n)] [inst5628_7 : ∀ n, LE (A n)]
(κ : (n : ℕ) → Kernel (LocalHistory O M n) O)
(send : (n : ℕ) → (LocalHistory O M n) × O → M)
structure LocalObservableExecution where
state : (n : ℕ) → LocalHistory O M n → ReferenceFunctional (A n) ι
positive_state : ∀ n h, PositiveFunctional (state n h)
positive_unit : ∀ n, (0 : A n) ≤ 1
normalized : ∀ n h, trace (state n h 1) = 1
measurable_reference : ∀ n, Measurable (fun h => state n h 1)
instrument : (n : ℕ) → (h : LocalHistory O M n) → ObservableInstrument O (A n) (A (n+1))
run : ∀ n h, InstrumentRun (instrument n h) (state n h)
run_law : ∀ n h, (run n h).law = κ n h
active_update : ∀ n h,
(fun o => state (n+1) (localActive h o (send n (h,o)))) =ᵐ[κ n h] (run n h).posterior
receive : (n : ℕ) → LocalHistory O M n → M → (A (n+1) →ₗ[ℂ] A n)
receive_positive : ∀ n h m x, 0 ≤ x → 0 ≤ receive n h m x
receive_unit : ∀ n h m, receive n h m 1 = 1
passive_update : ∀ n h m,
state (n+1) (localPassive h m) = (state n h).comp (receive n h m)
namespace LocalObservableExecution
variable {A κ send} (e : LocalObservableExecution (ι := ι) A κ send)
def reference (n : ℕ) (h : LocalHistory O M n) : Matrix ι ι ℂ := e.state n h 1
omit inst5628_3 in
lemma reference_density [DecidableEq ι] (n : ℕ) (h : LocalHistory O M n) :
ZeroKey.Density (e.reference n h) :=
⟨e.positive_state n h 1 (e.positive_unit n), e.normalized n h⟩
omit inst5628_3 in
lemma reference_measurable [DecidableEq ι] (n : ℕ) : Measurable (e.reference n) := e.measurable_reference n
lemma active_mean (n : ℕ) (h : LocalHistory O M n) (i j : ι) :
(∫ o, e.reference (n+1) (localActive h o (send n (h,o))) i j ∂κ n h) =
e.reference n h i j := by
calc
_ = ∫ o, (e.run n h).posterior o 1 i j ∂κ n h := by
apply integral_congr_ae
filter_upwards [e.active_update n h] with o ho
exact congrArg (fun S : ReferenceFunctional (A (n+1)) ι => S 1 i j) ho
_ = _ := by
rw [← e.run_law]
exact InstrumentRun.reference_mean (e.instrument n h) (e.state n h) (e.run n h) i j
omit inst5628_3 in
lemma passive_reference [DecidableEq ι] (n : ℕ) (h : LocalHistory O M n) (m : M) :
e.reference (n+1) (localPassive h m) = e.reference n h := by
simp only [reference,e.passive_update,LinearMap.comp_apply,e.receive_unit]
end LocalObservableExecution
end UnrestrictedQuantum
namespace ZeroKey
section
open MeasureTheory ProbabilityTheory
universe v5828_0 v5828_1
theorem condIndep_adaptive_public_message {Ω : Type v5828_0} {M : Type v5828_1}
{mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] [MeasurableSpace M]
{P : Measure Ω} [IsFiniteMeasure P]
{C A B : MeasurableSpace Ω}
(hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ)
(h : CondIndep C A B hC P)
(q : Ω → Bool) (a b : Ω → M) (d : M)
(hq : @Measurable Ω Bool C _ q)
(ha : @Measurable Ω M (A ⊔ C) _ a)
(hb : @Measurable Ω M (B ⊔ C) _ b) :
let message := fun x => if q x then a x else b x
let N := C ⊔ MeasurableSpace.comap message inferInstance
CondIndep N A B (sup_le hC ((ha.mono (sup_le hA hC) le_rfl).ite
((measurableSet_singleton true).preimage (hq.mono hC le_rfl))
(hb.mono (sup_le hB hC) le_rfl)).comap_le) P := by
let left := fun x => if q x then a x else d
let right := fun x => if q x then d else b x
let NA := C ⊔ MeasurableSpace.comap left inferInstance
let NB := NA ⊔ MeasurableSpace.comap right inferInstance
let g := fun x => if q x then a x else b x
let N := C ⊔ MeasurableSpace.comap g inferInstance
have hqset : MeasurableSet[C] {x | q x = true} := hq (measurableSet_singleton true)
have hleft : @Measurable Ω M (A ⊔ C) _ left :=
ha.ite ((show C ≤ A ⊔ C from le_sup_right) _ hqset) measurable_const
have hCA : C ≤ NA := le_sup_left
have hNAA : NA ≤ A ⊔ C := sup_le le_sup_right hleft.comap_le
have hNAM : NA ≤ mΩ := hNAA.trans (sup_le hA hC)
have h₁ : CondIndep NA A B hNAM P := condIndep_local_message hC hA hB hCA hNAA h
have hright : @Measurable Ω M (B ⊔ NA) _ right :=
measurable_const.ite ((hCA.trans le_sup_right) _ hqset)
(hb.mono (sup_le_sup_left hCA B) le_rfl)
have hNBB : NB ≤ B ⊔ NA := sup_le le_sup_right hright.comap_le
have hNBM : NB ≤ mΩ := hNBB.trans (sup_le hB hNAM)
have h₂ : CondIndep NB A B hNBM P :=
(condIndep_local_message hNAM hB hA le_sup_left hNBB h₁.symm).symm
have hCN : C ≤ N := le_sup_left
have hgN : @Measurable Ω M N _ g := Measurable.of_comap_le le_sup_right
have hlN : @Measurable Ω M N _ left := by
have hh : @Measurable Ω M N _ (fun x => if q x then g x else d) :=
hgN.ite (hCN _ hqset) measurable_const
convert hh using 1
ext x
cases hqx : q x <;> simp [left,g,hqx]
have hrN : @Measurable Ω M N _ right := by
have hh : @Measurable Ω M N _ (fun x => if q x then d else g x) :=
measurable_const.ite (hCN _ hqset) hgN
convert hh using 1
ext x
cases hqx : q x <;> simp [right,g,hqx]
have hNBN : NB ≤ N := sup_le (sup_le hCN hlN.comap_le) hrN.comap_le
have hCNB : C ≤ NB := le_sup_left.trans le_sup_left
have hlNB : @Measurable Ω M NB _ left :=
Measurable.of_comap_le (le_sup_right.trans le_sup_left)
have hrNB : @Measurable Ω M NB _ right := Measurable.of_comap_le le_sup_right
have hgNB : @Measurable Ω M NB _ g := by
have hh : @Measurable Ω M NB _ (fun x => if q x then left x else right x) :=
hlNB.ite (hCNB _ hqset) hrNB
convert hh using 1
ext x
cases hqx : q x <;> simp [left,right,g,hqx]
have he : NB = N := le_antisymm hNBN (sup_le hCNB hgNB.comap_le)
simpa only [he] using h₂
open MeasureTheory ProbabilityTheory
universe v5898_0 v5898_1
theorem adaptive_tapes_given_full_transcript {Ω : Type v5898_0} {M : Type v5898_1}
{mΩ : MeasurableSpace Ω} [StandardBorelSpace Ω] [MeasurableSpace M]
{P : Measure Ω} [IsFiniteMeasure P]
(F : Filtration ℕ mΩ) (A B : MeasurableSpace Ω)
(hA : A ≤ mΩ) (hB : B ≤ mΩ)
(hinitial : CondIndep (F 0) A B (F.le 0) P)
(q : ℕ → Ω → Bool) (a b : ℕ → Ω → M) (d : M)
(hq : ∀ n, @Measurable Ω Bool (F n) _ (q n))
(ha : ∀ n, @Measurable Ω M (A ⊔ F n) _ (a n))
(hb : ∀ n, @Measurable Ω M (B ⊔ F n) _ (b n))
(hF : ∀ n, F (n+1) = F n ⊔ MeasurableSpace.comap
(fun x => if q n x then a n x else b n x) inferInstance) :
CondIndep (⨆ n, F n) (A ⊔ ⨆ n, F n) (B ⊔ ⨆ n, F n)
(iSup_le F.le) P := by
have hfinite : ∀ n, CondIndep (F n) A B (F.le n) P := by
intro n
induction n with
| zero => exact hinitial
| succ n ih =>
have h := condIndep_adaptive_public_message (F.le n) hA hB ih
(q n) (a n) (b n) d (hq n) (ha n) (hb n)
simpa only [hF n] using h
have h := condIndep_full_transcript F A B hA hB hfinite
have hC := iSup_le F.le
have h1 := (condIndep_join_public_right hC hB hA h.symm).symm
exact condIndep_join_public_right hC (sup_le hA hC) hB h1
universe v5935_0 v5935_1 v5935_2
structure AdaptiveTapeProgram (U : Type v5935_0) (V : Type v5935_1) (M : Type v5935_2) [MeasurableSpace U]
[MeasurableSpace V] [MeasurableSpace M] where
alice : (n : ℕ) → (Fin n → M) → Bool
measAlice : ∀ n, Measurable (alice n)
sendA : (n : ℕ) → U × (Fin n → M) → M
sendB : (n : ℕ) → V × (Fin n → M) → M
measA : ∀ n, Measurable (sendA n)
measB : ∀ n, Measurable (sendB n)
namespace AdaptiveTapeProgram
universe v5945_0 v5945_1 v5945_2
variable {U : Type v5945_0} {V : Type v5945_1} {M : Type v5945_2} [inst5945_0 : MeasurableSpace U] [inst5945_1 : MeasurableSpace V] [inst5945_2 : MeasurableSpace M]
(p : AdaptiveTapeProgram U V M)
def publicPrefix : (n : ℕ) → U × V → (Fin n → M)
| 0, _ => Fin.elim0
| n+1, ω => Fin.snoc (publicPrefix n ω)
(if p.alice n (publicPrefix n ω) then p.sendA n (ω.1,publicPrefix n ω) else p.sendB n (ω.2,publicPrefix n ω))
def message (n : ℕ) (ω : U × V) : M :=
if p.alice n (p.publicPrefix n ω) then p.sendA n (ω.1,p.publicPrefix n ω) else p.sendB n (ω.2,p.publicPrefix n ω)
lemma prefix_succ (n : ℕ) (ω : U × V) :
p.publicPrefix (n+1) ω = Fin.snoc (p.publicPrefix n ω) (p.message n ω) := rfl
lemma measurable_prefix : ∀ n, Measurable (p.publicPrefix n) := by
intro n
induction n with
| zero => exact Measurable.of_eval (fun i => Fin.elim0 i)
| succ n ih =>
apply Measurable.of_eval
intro i
refine Fin.lastCases ?_ (fun j => ?_) i
· simp only [publicPrefix, Fin.snoc_last]
exact ((p.measA n).comp (measurable_fst.prodMk ih)).ite
((measurableSet_singleton true).preimage ((p.measAlice n).comp ih))
((p.measB n).comp (measurable_snd.prodMk ih))
· simpa only [publicPrefix, Fin.snoc_castSucc] using ih.eval (a := j)
lemma measurable_message (n : ℕ) : Measurable (p.message n) := by
exact ((p.measA n).comp (measurable_fst.prodMk (p.measurable_prefix n))).ite
((measurableSet_singleton true).preimage ((p.measAlice n).comp (p.measurable_prefix n)))
((p.measB n).comp (measurable_snd.prodMk (p.measurable_prefix n)))
abbrev field (n : ℕ) : MeasurableSpace (U × V) :=
MeasurableSpace.comap (p.publicPrefix n) inferInstance
lemma field_le (n : ℕ) : p.field n ≤ (inferInstance : MeasurableSpace (U × V)) := (p.measurable_prefix n).comap_le
lemma field_mono : Monotone p.field := by
apply monotone_nat_of_le_succ
intro n
have h : @Measurable (U × V) (Fin n → M) (p.field (n+1)) _ (p.publicPrefix n) := by
let : MeasurableSpace (U × V) := p.field (n+1)
apply Measurable.of_eval
intro i
have hh := (@Measurable.of_comap_le (U × V) (Fin (n+1) → M)
(p.field (n+1)) _ (p.publicPrefix (n+1)) le_rfl).eval (a := i.castSucc)
simpa only [publicPrefix, Fin.snoc_castSucc] using hh
exact h.comap_le
def filtration : Filtration ℕ (inferInstance : MeasurableSpace (U × V)) where
seq := p.field
mono' := p.field_mono
le' := p.field_le
lemma field_zero : p.field 0 = ⊥ := by
exact MeasurableSpace.comap_const Fin.elim0
lemma field_succ (n : ℕ) :
p.field (n+1) = p.field n ⊔ MeasurableSpace.comap (p.message n) inferInstance := by
apply le_antisymm
· let : MeasurableSpace (U × V) := p.field n ⊔ MeasurableSpace.comap (p.message n) inferInstance
apply Measurable.comap_le
apply Measurable.of_eval
intro i
refine Fin.lastCases ?_ (fun j => ?_) i
· simpa only [prefix_succ,Fin.snoc_last] using
(Measurable.of_comap_le (f := p.message n) le_sup_right)
· simpa only [prefix_succ,Fin.snoc_castSucc,field] using
(Measurable.of_comap_le (f := p.publicPrefix n) le_sup_left).eval (a := j)
· apply sup_le (p.field_mono (Nat.le_succ n))
let : MeasurableSpace (U × V) := p.field (n+1)
have h := (@Measurable.of_comap_le (U × V) (Fin (n+1) → M)
(p.field (n+1)) _ (p.publicPrefix (n+1)) le_rfl).eval (a := Fin.last n)
have hh : Measurable[p.field (n+1)] (p.message n) := by
simpa only [prefix_succ,Fin.snoc_last] using h
exact hh.comap_le
theorem tapes_conditionally_independent [StandardBorelSpace U] [StandardBorelSpace V]
[Nonempty M]
(μ : Measure U) (ν : Measure V) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] :
CondIndep (⨆ n, p.field n)
(MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ⊔ ⨆ n, p.field n)
(MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ⊔ ⨆ n, p.field n)
(iSup_le p.field_le) (μ.prod ν) := by
refine adaptive_tapes_given_full_transcript (P := μ.prod ν) p.filtration _ _
measurable_fst.comap_le measurable_snd.comap_le ?_
(fun n ω => p.alice n (p.publicPrefix n ω))
(fun n ω => p.sendA n (ω.1,p.publicPrefix n ω))
(fun n ω => p.sendB n (ω.2,p.publicPrefix n ω)) (Classical.arbitrary M) ?_ ?_ ?_ ?_
· change CondIndep (p.field 0) _ _ _ _
have h0 := indep_condIndep_bot measurable_fst.comap_le measurable_snd.comap_le
(P := μ.prod ν) (indepFun_prod (μ := μ) (ν := ν) measurable_id measurable_id)
simpa only [p.field_zero] using h0
· intro n
exact (p.measAlice n).comp (Measurable.of_comap_le le_rfl)
· intro n
exact (p.measA n).comp ((Measurable.of_comap_le le_sup_left).prodMk
(Measurable.of_comap_le le_sup_right))
· intro n
exact (p.measB n).comp ((Measurable.of_comap_le le_sup_left).prodMk
(Measurable.of_comap_le le_sup_right))
· exact p.field_succ
def record (ω : U × V) (n : ℕ) : M := p.message n ω
lemma measurable_record : Measurable p.record :=
Measurable.of_eval p.measurable_message
lemma prefix_eq_record (n : ℕ) (ω : U × V) (i : Fin n) :
p.publicPrefix n ω i = p.record ω i := by
induction n with
| zero => exact Fin.elim0 i
| succ n ih =>
refine Fin.lastCases ?_ (fun j => ?_) i
· simp only [publicPrefix, Fin.snoc_last, record, message, Fin.val_last]
· simpa only [publicPrefix, Fin.snoc_castSucc, Fin.val_castSucc] using ih j
lemma full_record_field :
MeasurableSpace.comap p.record inferInstance = ⨆ n, p.field n := by
apply le_antisymm
· let : MeasurableSpace (U × V) := ⨆ n, p.field n
apply Measurable.comap_le
apply Measurable.of_eval
intro n
have h : @Measurable (U × V) (Fin (n+1) → M) (⨆ n, p.field n) _
(p.publicPrefix (n+1)) := Measurable.of_comap_le (le_iSup p.field (n+1))
simpa only [publicPrefix, Fin.snoc_last, record, message] using h.eval (a := Fin.last n)
· apply iSup_le
intro n
let : MeasurableSpace (U × V) := MeasurableSpace.comap p.record inferInstance
apply Measurable.comap_le
apply Measurable.of_eval
intro i
simp_rw [prefix_eq_record]
exact (Measurable.of_comap_le (f := p.record) le_rfl).eval
universe v6086_0 v6086_1
theorem final_records_conditionally_independent [Nonempty M]
[StandardBorelSpace U] [StandardBorelSpace V]
(μ : Measure U) (ν : Measure V) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν]
{A : Type v6086_0} {B : Type v6086_1} [MeasurableSpace A] [MeasurableSpace B]
(readA : U × (ℕ → M) → A) (readB : V × (ℕ → M) → B)
(ha : Measurable readA) (hb : Measurable readB) :
CondIndepFun (MeasurableSpace.comap p.record inferInstance)
p.measurable_record.comap_le
(fun ω => readA (ω.1,p.record ω))
(fun ω => readB (ω.2,p.record ω)) (μ.prod ν) := by
have h := p.tapes_conditionally_independent μ ν
rw [condIndepFun_iff_condIndep]
have hA : MeasurableSpace.comap (fun ω => readA (ω.1,p.record ω)) inferInstance ≤
MeasurableSpace.comap Prod.fst ‹MeasurableSpace U› ⊔ ⨆ n, p.field n := by
apply Measurable.comap_le
exact ha.comp ((Measurable.of_comap_le le_sup_left).prodMk
(Measurable.of_comap_le (p.full_record_field ▸ le_sup_right)))
have hB : MeasurableSpace.comap (fun ω => readB (ω.2,p.record ω)) inferInstance ≤
MeasurableSpace.comap Prod.snd ‹MeasurableSpace V› ⊔ ⨆ n, p.field n := by
apply Measurable.comap_le
exact hb.comp ((Measurable.of_comap_le le_sup_left).prodMk
(Measurable.of_comap_le (p.full_record_field ▸ le_sup_right)))
have h' := condIndep_of_condIndep_of_le_right
(condIndep_of_condIndep_of_le_left h hA) hB
simpa only [p.full_record_field] using h'
end AdaptiveTapeProgram
end
section
open MeasureTheory ProbabilityTheory Set Function unitInterval
section
universe v6124_0
variable {N : Type v6124_0} [inst6124_0 : MeasurableSpace N] (ν : Measure N) [inst6124_1 : IsProbabilityMeasure ν]
def noiseTapeLaw : Measure (ℕ → N) := Measure.infinitePi (fun _ => ν)
instance noiseTapeLaw_probability : IsProbabilityMeasure (noiseTapeLaw ν) := by
unfold noiseTapeLaw
infer_instance
lemma noise_prefix_fresh_independent (n : ℕ) :
IndepFun (fun u : (ℕ → N) => fun i : Fin n => u i) (fun u => u n) (noiseTapeLaw ν) := by
have h := iIndepFun_infinitePi (P := fun _ : ℕ => ν)
(X := fun _ x => x) (fun _ => measurable_id)
have hd : Disjoint (Finset.range n) {n} := by simp
have hh := h.indepFun_finset (Finset.range n) {n} hd (fun i => measurable_pi_apply i)
have hh' := hh.comp
(show Measurable (fun x : (i : Finset.range n) → N => fun j : Fin n =>
x ⟨j,Finset.mem_range.mpr j.isLt⟩) from by fun_prop)
(show Measurable (fun x : (i : ({n} : Finset ℕ)) → N => x ⟨n,by simp⟩) from by fun_prop)
exact hh'
lemma noise_tape_eval (n : ℕ) : (noiseTapeLaw ν).map (fun u => u n) = ν :=
Measure.infinitePi_map_eval _ _
universe v6146_0 v6146_1
structure NoiseSampler (N : Type v6146_0) (O : Type v6146_1) [MeasurableSpace N] [MeasurableSpace O] where
step : (n : ℕ) → (Fin n → O) × N → O
measurable_step : ∀ n, Measurable (step n)
namespace NoiseSampler
variable {ν}
universe v6152_0
variable {O : Type v6152_0} [inst6152_0 : MeasurableSpace O] (f : NoiseSampler N O)
def finiteHistory : (n : ℕ) → (Fin n → N) → (Fin n → O)
| 0, _ => Fin.elim0
| n+1, u => Fin.snoc (finiteHistory n (fun i => u i.castSucc))
(f.step n (finiteHistory n (fun i => u i.castSucc), u (Fin.last n)))
lemma measurable_finiteHistory : ∀ n, Measurable (f.finiteHistory n) := by
intro n
induction n with
| zero => exact Measurable.of_eval (fun i => Fin.elim0 i)
| succ n ih =>
have hr : Measurable (fun u : Fin (n+1) → N => fun i : Fin n => u i.castSucc) := by fun_prop
apply Measurable.of_eval
intro i
refine Fin.lastCases ?_ (fun j => ?_) i
· simpa only [finiteHistory, Fin.snoc_last,Function.comp_def] using
(f.measurable_step n).comp ((ih.comp hr).prodMk (measurable_pi_apply (Fin.last n)))
· simpa only [finiteHistory, Fin.snoc_castSucc,Function.comp_def] using (ih.comp hr).eval (a := j)
def history (n : ℕ) (u : (ℕ → N)) : Fin n → O :=
f.finiteHistory n (fun i => u i)
lemma measurable_prefix (n : ℕ) : Measurable (f.history n) :=
(f.measurable_finiteHistory n).comp (by fun_prop)
lemma prefix_succ (n : ℕ) (u : (ℕ → N)) :
f.history (n+1) u = Fin.snoc (f.history n u) (f.step n (f.history n u,u n)) := rfl
lemma prefix_fresh_independent (n : ℕ) :
IndepFun (f.history n) (fun u => u n) (noiseTapeLaw ν) :=
(noise_prefix_fresh_independent ν n).comp (f.measurable_finiteHistory n) measurable_id
lemma prefix_fresh_law (n : ℕ) :
(noiseTapeLaw ν).map (fun u => (f.history n u,u n)) =
((noiseTapeLaw ν).map (f.history n)).prod ν := by
rw [(f.prefix_fresh_independent (ν := ν) n).map_prod_eq_prod_map_map
(f.measurable_prefix n).aemeasurable (measurable_pi_apply n).aemeasurable,
noise_tape_eval]
theorem prefix_law_succ (κ : (n : ℕ) → Kernel (Fin n → O) O)
[∀ n, IsMarkovKernel (κ n)]
(hlaw : ∀ n s, ν.map (fun u => f.step n (s,u)) = κ n s)
(n : ℕ) :
(noiseTapeLaw ν).map (f.history (n+1)) =
(((noiseTapeLaw ν).map (f.history n)) ⊗ₘ κ n).map (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2) := by
have hfresh := f.prefix_fresh_law (ν := ν) n
have hsample : (((noiseTapeLaw ν).map (f.history n)).prod ν).map
(fun p => (p.1, f.step n p)) = ((noiseTapeLaw ν).map (f.history n)) ⊗ₘ κ n := by
ext B hB
rw [Measure.map_apply (measurable_fst.prodMk (f.measurable_step n)) hB,
Measure.prod_apply (hB.preimage (measurable_fst.prodMk (f.measurable_step n))),
Measure.compProd_apply hB]
congr 1
funext s
have hm : Measurable (fun u : N => f.step n (s,u)) := by
simpa only [Function.comp_def, id_eq] using
((f.measurable_step n).comp ((measurable_const (a := s)).prodMk measurable_id))
rw [← hlaw n s, Measure.map_apply hm (measurable_prodMk_left hB)]
rfl
have hs : Measurable (fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2) := by
apply Measurable.of_eval
intro i
refine Fin.lastCases ?_ (fun j => ?_) i
· simpa only [Fin.snoc_last] using measurable_snd
· simpa only [Fin.snoc_castSucc, Function.comp_def] using (measurable_pi_apply j).comp measurable_fst
rw [← hsample, ← hfresh,
Measure.map_map (measurable_fst.prodMk (f.measurable_step n))
((f.measurable_prefix n).prodMk (measurable_pi_apply n)),
Measure.map_map hs ((measurable_fst.prodMk (f.measurable_step n)).comp
((f.measurable_prefix n).prodMk (measurable_pi_apply n)))]
rfl
def record (u : (ℕ → N)) (n : ℕ) : O := f.step n (f.history n u,u n)
lemma measurable_record : Measurable f.record :=
Measurable.of_eval (fun n =>
(f.measurable_step n).comp ((f.measurable_prefix n).prodMk (measurable_pi_apply n)))
lemma prefix_eq_record (n : ℕ) (u : (ℕ → N)) (i : Fin n) :
f.history n u i = f.record u i := by
induction n with
| zero => exact Fin.elim0 i
| succ n ih =>
rw [f.prefix_succ]
refine Fin.lastCases ?_ (fun j => ?_) i
· simp only [Fin.snoc_last,record, Fin.val_last]
· simpa only [Fin.snoc_castSucc, Fin.val_castSucc] using ih j
theorem finite_law_unique (κ : (n : ℕ) → Kernel (Fin n → O) O)
[∀ n, IsMarkovKernel (κ n)]
(hlaw : ∀ n s, ν.map (fun u => f.step n (s,u)) = κ n s)
(P : Measure (ℕ → O)) [IsProbabilityMeasure P]
(hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) =
((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map
(fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2)) :
∀ n, P.map (fun x => fun i : Fin n => x i) = (noiseTapeLaw ν).map (f.history n) := by
intro n
induction n with
| zero =>
have ht : (fun x : ℕ → O => fun i : Fin 0 => x i) = fun _ => Fin.elim0 := by
funext x i
exact Fin.elim0 i
rw [ht]
change P.map (fun _ : ℕ → O => Fin.elim0) =
(noiseTapeLaw ν).map (fun _ : (ℕ → N) => Fin.elim0)
simp
| succ n ih => rw [hP n, ih, f.prefix_law_succ κ hlaw]
theorem record_law_unique (κ : (n : ℕ) → Kernel (Fin n → O) O)
[∀ n, IsMarkovKernel (κ n)]
(hlaw : ∀ n s, ν.map (fun u => f.step n (s,u)) = κ n s)
(P : Measure (ℕ → O)) [IsProbabilityMeasure P]
(hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) =
((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map
(fun p : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) p.1 p.2)) :
P = (noiseTapeLaw ν).map f.record := by
let Q := (noiseTapeLaw ν).map f.record
have hQ : IsProbabilityMeasure Q := inferInstance
apply IsProjectiveLimit.unique (P := fun J : Finset ℕ => Q.map J.restrict) ?_
(show IsProjectiveLimit Q (fun J : Finset ℕ => Q.map J.restrict) from fun _ => rfl)
intro J
let n := J.sup id + 1
let index : J → Fin n := fun j => ⟨j.1,Nat.lt_succ_of_le (Finset.le_sup (f := id) j.2)⟩
let cut : (Fin n → O) → (J → O) := fun x j => x (index j)
have hc : Measurable cut := by fun_prop
have h := congrArg (fun ν : Measure (Fin n → O) => ν.map cut)
(f.finite_law_unique κ hlaw P hP n)
rw [Measure.map_map hc (by fun_prop), Measure.map_map hc (f.measurable_prefix n)] at h
change P.map J.restrict = ((noiseTapeLaw ν).map f.record).map J.restrict
rw [Measure.map_map (Finset.measurable_restrict J) f.measurable_record]
have heL : cut ∘ (fun x : ℕ → O => fun i : Fin n => x i) = J.restrict := rfl
have heR : cut ∘ f.history n = J.restrict ∘ f.record := by
funext u j
exact f.prefix_eq_record n u (index j)
rwa [heL,heR] at h
end NoiseSampler
end
universe v6315_0 v6315_1
structure AdaptiveOutcomeSampler (O : Type v6315_0) (M : Type v6315_1) [MeasurableSpace O] [MeasurableSpace M] where
alice : (n : ℕ) → (Fin n → M) → Bool
alice_meas : ∀ n, Measurable (alice n)
sampleA : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × I → O
sampleB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × I → O
sendA : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M
sendB : (n : ℕ) → ((Fin n → (O ⊕ Unit)) × (Fin n → M)) × O → M
sampleA_meas : ∀ n, Measurable (sampleA n)
sampleB_meas : ∀ n, Measurable (sampleB n)
sendA_meas : ∀ n, Measurable (sendA n)
sendB_meas : ∀ n, Measurable (sendB n)
namespace AdaptiveOutcomeSampler
section
universe v6328_0 v6328_1
variable {O : Type v6328_0} {M : Type v6328_1} [inst6328_0 : MeasurableSpace O] [inst6328_1 : MeasurableSpace M]
(p : AdaptiveOutcomeSampler O M)
def privatePrefix (a : Bool) : (n : ℕ) → UniformTape × (Fin n → M) → (Fin n → (O ⊕ Unit))
| 0, _ => Fin.elim0
| n+1, pair =>
let old := privatePrefix a n (pair.1,fun i => pair.2 i.castSucc)
let pubPast := fun i : Fin n => pair.2 i.castSucc
Fin.snoc old (if p.alice n pubPast = a then Sum.inl
(if a then p.sampleA n ((old,pubPast),pair.1 n)
else p.sampleB n ((old,pubPast),pair.1 n)) else Sum.inr ())
lemma measurable_privatePrefix (a : Bool) : ∀ n, Measurable (p.privatePrefix a n) := by
intro n
induction n with
| zero => exact Measurable.of_eval (fun i => Fin.elim0 i)
| succ n ih =>
have hr : Measurable (fun pair : UniformTape × (Fin (n+1) → M) =>
(pair.1,fun i : Fin n => pair.2 i.castSucc)) := by fun_prop
have hv : Measurable (fun pair : UniformTape × (Fin (n+1) → M) =>
fun i : Fin n => pair.2 i.castSucc) := by fun_prop
apply Measurable.of_eval
intro i
refine Fin.lastCases ?_ (fun j => ?_) i
· simp only [privatePrefix,Fin.snoc_last]
apply Measurable.ite ((measurableSet_singleton a).preimage ((p.alice_meas n).comp hv)) _ measurable_const
apply measurable_inl.comp
cases a
· exact (p.sampleB_meas n).comp (((ih.comp hr).prodMk hv).prodMk
((measurable_pi_apply n).comp measurable_fst))
· exact (p.sampleA_meas n).comp (((ih.comp hr).prodMk hv).prodMk
((measurable_pi_apply n).comp measurable_fst))
· simpa only [privatePrefix,Fin.snoc_castSucc,Function.comp_def] using
(ih.comp hr).eval (a := j)
def tapeProgram : AdaptiveTapeProgram UniformTape UniformTape M where
alice := p.alice
measAlice := p.alice_meas
sendA n pair := p.sendA n ((p.privatePrefix true n pair,pair.2),
p.sampleA n ((p.privatePrefix true n pair,pair.2),pair.1 n))
sendB n pair := p.sendB n ((p.privatePrefix false n pair,pair.2),
p.sampleB n ((p.privatePrefix false n pair,pair.2),pair.1 n))
measA n := (p.sendA_meas n).comp
(((p.measurable_privatePrefix true n).prodMk measurable_snd).prodMk
((p.sampleA_meas n).comp (((p.measurable_privatePrefix true n).prodMk measurable_snd).prodMk
((measurable_pi_apply n).comp measurable_fst))))
measB n := (p.sendB_meas n).comp
(((p.measurable_privatePrefix false n).prodMk measurable_snd).prodMk
((p.sampleB_meas n).comp (((p.measurable_privatePrefix false n).prodMk measurable_snd).prodMk
((measurable_pi_apply n).comp measurable_fst))))
def replay : (n : ℕ) → (Fin n → O) →
((Fin n → (O ⊕ Unit)) × (Fin n → (O ⊕ Unit))) × (Fin n → M) :=
Nat.rec (fun _ => ((Fin.elim0,Fin.elim0),Fin.elim0)) (fun n previous x =>
let r := previous (fun i => x i.castSucc)
let o := x (Fin.last n)
let q := p.alice n r.2
((Fin.snoc r.1.1 (if q then Sum.inl o else Sum.inr ()),
Fin.snoc r.1.2 (if q then Sum.inr () else Sum.inl o)),
Fin.snoc r.2 (if q then p.sendA n ((r.1.1,r.2),o) else p.sendB n ((r.1.2,r.2),o))))
universe v6393_0 v6393_1
lemma measurable_snoc {Z : Type v6393_0} {X : Type v6393_1} [MeasurableSpace Z] [MeasurableSpace X]
{n : ℕ} (f : Z → (Fin n → X)) (g : Z → X)
(hf : Measurable f) (hg : Measurable g) :
Measurable (fun x => Fin.snoc (α := fun _ : Fin (n+1) => X) (f x) (g x)) := by
apply Measurable.of_eval
intro i
refine Fin.lastCases ?_ (fun j => ?_) i
· simpa only [Fin.snoc_last] using hg
· simpa only [Fin.snoc_castSucc] using hf.eval (a := j)
lemma measurable_replay : ∀ n, Measurable (p.replay n) := by
intro n
induction n with
| zero => exact measurable_const
| succ n ih =>
have hr : Measurable (fun x : Fin (n+1) → O => fun i : Fin n => x i.castSucc) := by fun_prop
have hR := ih.comp hr
have hq := (p.alice_meas n).comp hR.snd
have hqs := (measurableSet_singleton true).preimage hq
exact ((measurable_snoc _ _ hR.fst.fst ((measurable_inl.comp (measurable_pi_apply (Fin.last n))).ite hqs measurable_const)).prodMk
(measurable_snoc _ _ hR.fst.snd (measurable_const.ite hqs (measurable_inl.comp (measurable_pi_apply (Fin.last n)))))).prodMk
(measurable_snoc _ _ hR.snd (((p.sendA_meas n).comp ((hR.fst.fst.prodMk hR.snd).prodMk (measurable_pi_apply (Fin.last n)))).ite hqs
((p.sendB_meas n).comp ((hR.fst.snd.prodMk hR.snd).prodMk (measurable_pi_apply (Fin.last n))))))
def extractPrivate (a : Bool) (n : ℕ) (x : Fin n → O) : Fin n → O ⊕ Unit :=
if a then (p.replay n x).1.1 else (p.replay n x).1.2
def publicFrom (n : ℕ) (x : Fin n → O) : Fin n → M := (p.replay n x).2
lemma measurable_extractPrivate (a : Bool) (n : ℕ) : Measurable (p.extractPrivate a n) := by
cases a
· exact (p.measurable_replay n).fst.snd
· exact (p.measurable_replay n).fst.fst
lemma measurable_publicFrom (n : ℕ) : Measurable (p.publicFrom n) := (p.measurable_replay n).snd
lemma extractPrivate_snoc (a : Bool) (n : ℕ) (x : Fin n → O) (z : O) :
p.extractPrivate a (n+1) (Fin.snoc (α := fun _ => O) x z) =
Fin.snoc (p.extractPrivate a n x) (if p.alice n (p.publicFrom n x) = a then Sum.inl z else Sum.inr ()) := by
cases a <;> cases hq : p.alice n (p.publicFrom n x) <;>
simp only [extractPrivate,replay,Fin.snoc_castSucc,Fin.snoc_last,publicFrom] at hq ⊢ <;> simp [hq]
lemma publicFrom_snoc (n : ℕ) (x : Fin n → O) (z : O) :
p.publicFrom (n+1) (Fin.snoc (α := fun _ => O) x z) =
Fin.snoc (p.publicFrom n x) (if p.alice n (p.publicFrom n x) then
p.sendA n ((p.extractPrivate true n x,p.publicFrom n x),z) else
p.sendB n ((p.extractPrivate false n x,p.publicFrom n x),z)) := by
simp only [publicFrom,replay,extractPrivate,Fin.snoc_castSucc,Fin.snoc_last,Bool.false_eq_true,↓reduceIte]
lemma privatePrefix_snoc (a : Bool) (n : ℕ) (u : UniformTape) (h : Fin n → M) (z : M) :
p.privatePrefix a (n+1) (u,Fin.snoc (α := fun _ => M) h z) =
Fin.snoc (p.privatePrefix a n (u,h)) (if p.alice n h = a then Sum.inl
(if a then p.sampleA n ((p.privatePrefix a n (u,h),h),u n)
else p.sampleB n ((p.privatePrefix a n (u,h),h),u n)) else Sum.inr ()) := by
simp only [privatePrefix,Fin.snoc_castSucc]
/-- The sampled outcome history, without a bundled measurability certificate. -/
def causalStep (n : ℕ) (pair : (Fin n → O) × (I × I)) : O :=
if p.alice n (p.publicFrom n pair.1) then
p.sampleA n ((p.extractPrivate true n pair.1, p.publicFrom n pair.1), pair.2.1)
else p.sampleB n ((p.extractPrivate false n pair.1, p.publicFrom n pair.1), pair.2.2)
def causalHistory : (n : ℕ) → (Fin n → I × I) → (Fin n → O)
| 0, _ => Fin.elim0
| n+1, u => Fin.snoc (causalHistory n (fun i => u i.castSucc))
(p.causalStep n (causalHistory n (fun i => u i.castSucc), u (Fin.last n)))
def causalRecord (u : ℕ → I × I) (n : ℕ) : O :=
p.causalStep n (p.causalHistory n (fun i => u i), u n)
def causal : NoiseSampler (I × I) O where
step n pair := if p.alice n (p.publicFrom n pair.1) then
p.sampleA n ((p.extractPrivate true n pair.1,p.publicFrom n pair.1),pair.2.1) else
p.sampleB n ((p.extractPrivate false n pair.1,p.publicFrom n pair.1),pair.2.2)
measurable_step n :=
((p.sampleA_meas n).comp ((((p.measurable_extractPrivate true n).comp measurable_fst).prodMk
((p.measurable_publicFrom n).comp measurable_fst)).prodMk measurable_snd.fst)).ite
((measurableSet_singleton true).preimage ((p.alice_meas n).comp ((p.measurable_publicFrom n).comp measurable_fst)))
((p.sampleB_meas n).comp ((((p.measurable_extractPrivate false n).comp measurable_fst).prodMk
((p.measurable_publicFrom n).comp measurable_fst)).prodMk measurable_snd.snd))
lemma causalRecord_eq : p.causalRecord = p.causal.record := by
have h (n : ℕ) : p.causalHistory n = p.causal.finiteHistory n := by
induction n with
| zero => rfl
| succ n ih =>
funext u
simp only [causalHistory, NoiseSampler.finiteHistory, ih]
rfl
funext u n
change p.causalStep n (p.causalHistory n (fun i => u i), u n) =
p.causal.step n (p.causal.finiteHistory n (fun i => u i), u n)
rw [h n]
rfl
def pairedTape (uv : UniformTape × UniformTape) (n : ℕ) : I × I := (uv.1 n,uv.2 n)
lemma measurable_pairedTape : Measurable pairedTape := by unfold pairedTape; fun_prop
theorem replay_matches (n : ℕ) (uv : UniformTape × UniformTape) :
p.publicFrom n (p.causal.history n (pairedTape uv)) = p.tapeProgram.publicPrefix n uv ∧
(∀ a, p.extractPrivate a n (p.causal.history n (pairedTape uv)) =
p.privatePrefix a n ((if a then uv.1 else uv.2),p.tapeProgram.publicPrefix n uv)) := by
induction n with
| zero => exact ⟨rfl,fun a => by cases a <;> rfl⟩
| succ n ih =>
have hs : p.causal.step n (p.causal.history n (pairedTape uv),pairedTape uv n) =
if p.alice n (p.tapeProgram.publicPrefix n uv) then
p.sampleA n ((p.privatePrefix true n (uv.1,p.tapeProgram.publicPrefix n uv),
p.tapeProgram.publicPrefix n uv),uv.1 n) else
p.sampleB n ((p.privatePrefix false n (uv.2,p.tapeProgram.publicPrefix n uv),
p.tapeProgram.publicPrefix n uv),uv.2 n) := by
change (if p.alice n (p.publicFrom n (p.causal.history n (pairedTape uv))) then
p.sampleA n ((p.extractPrivate true n (p.causal.history n (pairedTape uv)),
p.publicFrom n (p.causal.history n (pairedTape uv))),uv.1 n)
else p.sampleB n ((p.extractPrivate false n (p.causal.history n (pairedTape uv)),
p.publicFrom n (p.causal.history n (pairedTape uv))),uv.2 n)) = _
rw [ih.1,ih.2 true,ih.2 false]
simp only [Bool.false_eq_true,↓reduceIte]
rw [p.causal.prefix_succ,p.publicFrom_snoc,hs,ih.1,ih.2 true,ih.2 false]
simp only [Bool.false_eq_true,↓reduceIte]
constructor
· rw [p.tapeProgram.prefix_succ]
congr 1
unfold AdaptiveTapeProgram.message tapeProgram
split <;> simp_all only []
· intro a
rw [p.extractPrivate_snoc,ih.2 a,ih.1,p.tapeProgram.prefix_succ,p.privatePrefix_snoc]
congr 1
cases a <;> cases hrole : p.alice n (p.tapeProgram.publicPrefix n uv) <;>
simp only [Bool.false_eq_true,Bool.true_eq_false,↓reduceIte]
end
universe v6532_0 v6532_1
variable {O : Type v6532_0} {M : Type v6532_1} [inst6532_0 : MeasurableSpace O] [inst6532_1 : MeasurableSpace M]
(p : AdaptiveOutcomeSampler O M)
def instrumentKernel
(κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O)
(n : ℕ) : Kernel (Fin n → O) O := by
classical
exact Kernel.piecewise
((measurableSet_singleton true).preimage ((p.alice_meas n).comp (p.measurable_publicFrom n)))
((κA n).comap (fun x => (p.extractPrivate true n x,p.publicFrom n x))
((p.measurable_extractPrivate true n).prodMk (p.measurable_publicFrom n)))
((κB n).comap (fun x => (p.extractPrivate false n x,p.publicFrom n x))
((p.measurable_extractPrivate false n).prodMk (p.measurable_publicFrom n)))
lemma instrumentKernel_apply
(κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O)
(n : ℕ) (s : Fin n → O) :
p.instrumentKernel κA κB n s = if p.alice n (p.publicFrom n s) then
κA n (p.extractPrivate true n s,p.publicFrom n s) else
κB n (p.extractPrivate false n s,p.publicFrom n s) := by
classical
simp only [instrumentKernel,Kernel.piecewise_apply,Set.mem_preimage,Set.mem_singleton_iff,
Function.comp_def,Kernel.comap_apply]
instance instrumentKernel_markov
(κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O)
[∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) :
IsMarkovKernel (p.instrumentKernel κA κB n) := by
unfold instrumentKernel
infer_instance
lemma causal_step_law
(κA κB : (n : ℕ) → Kernel ((Fin n → (O ⊕ Unit)) × (Fin n → M)) O)
(ha : ∀ n s, volume.map (fun u => p.sampleA n (s,u)) = κA n s)
(hb : ∀ n s, volume.map (fun u => p.sampleB n (s,u)) = κB n s) :
∀ n s, (volume.prod volume).map (fun u => p.causal.step n (s,u)) =
p.instrumentKernel κA κB n s := by
intro n s
rw [p.instrumentKernel_apply κA κB n s]
change (volume.prod volume).map (fun u => if p.alice n (p.publicFrom n s) then
p.sampleA n ((p.extractPrivate true n s,p.publicFrom n s),u.1) else
p.sampleB n ((p.extractPrivate false n s,p.publicFrom n s),u.2)) = _
split
· have hm : Measurable (fun u : I => p.sampleA n ((p.extractPrivate true n s,p.publicFrom n s),u)) :=
(p.sampleA_meas n).comp (measurable_const.prodMk measurable_id)
have hh := Measure.map_map (μ := (volume : Measure I).prod volume) hm
(measurable_fst : Measurable (Prod.fst : I × I → I))
simp only [Measure.map_fst_prod, measure_univ, one_smul] at hh
exact hh.symm.trans (ha n _)
· have hm : Measurable (fun u : I => p.sampleB n ((p.extractPrivate false n s,p.publicFrom n s),u)) :=
(p.sampleB_meas n).comp (measurable_const.prodMk measurable_id)
have hh := Measure.map_map (μ := (volume : Measure I).prod volume) hm
(measurable_snd : Measurable (Prod.snd : I × I → I))
simp only [Measure.map_snd_prod, measure_univ, one_smul] at hh
exact hh.symm.trans (hb n _)
end AdaptiveOutcomeSampler
end
namespace AdaptiveQuantum
open Matrix MeasureTheory ProbabilityTheory
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
open UnrestrictedQuantum
universe v6604_0 v6604_1 v6604_2 v6604_3 v6604_4 v6604_5
variable {O : Type v6604_0} {M : Type v6604_1} {ι : Type v6604_2} {η : Type v6604_3} [inst6604_0 : MeasurableSpace O] [inst6604_1 : MeasurableSpace M]
[inst6604_2 : Fintype ι] [inst6604_3 : Fintype η] [inst6604_4 : DecidableEq ι] [inst6604_5 : DecidableEq η]
{A : ℕ → Type v6604_4} {B : ℕ → Type v6604_5}
[inst6604_6 : ∀ n, AddCommGroup (A n)] [inst6604_7 : ∀ n, Module ℂ (A n)] [inst6604_8 : ∀ n, One (A n)] [inst6604_9 : ∀ n, LE (A n)]
[inst6604_10 : ∀ n, AddCommGroup (B n)] [inst6604_11 : ∀ n, Module ℂ (B n)] [inst6604_12 : ∀ n, One (B n)] [inst6604_13 : ∀ n, LE (B n)]
(p : AdaptiveOutcomeSampler O M)
(κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O)
[inst6604_14 : ∀ n, IsMarkovKernel (κA n)] [inst6604_15 : ∀ n, IsMarkovKernel (κB n)]
(eA : LocalObservableExecution (ι := ι) A κA p.sendA)
(eB : LocalObservableExecution (ι := η) B κB p.sendB)
def globalLocalReferenceA (n : ℕ) (s : Fin n → O) : Matrix ι ι ℂ :=
eA.reference n (p.extractPrivate true n s,p.publicFrom n s)
def globalLocalReferenceB (n : ℕ) (s : Fin n → O) : Matrix η η ℂ :=
eB.reference n (p.extractPrivate false n s,p.publicFrom n s)
omit inst6604_14 in
lemma globalLocalReferenceA_measurable [∀ n, IsMarkovKernel (κA n)] (n : ℕ) :
Measurable (globalLocalReferenceA p κA eA n) :=
(eA.reference_measurable n).comp
((p.measurable_extractPrivate true n).prodMk (p.measurable_publicFrom n))
omit inst6604_15 in
lemma globalLocalReferenceB_measurable [∀ n, IsMarkovKernel (κB n)] (n : ℕ) :
Measurable (globalLocalReferenceB p κB eB n) :=
(eB.reference_measurable n).comp
((p.measurable_extractPrivate false n).prodMk (p.measurable_publicFrom n))
omit inst6604_14 in
lemma globalLocalReferenceA_mean [∀ n, IsMarkovKernel (κA n)] (n : ℕ) (s : Fin n → O) (i j : ι) :
(∫ o, globalLocalReferenceA p κA eA (n+1) (Fin.snoc s o) i j
∂p.instrumentKernel κA κB n s) = globalLocalReferenceA p κA eA n s i j := by
unfold globalLocalReferenceA
simp_rw [p.extractPrivate_snoc, p.publicFrom_snoc]
rw [p.instrumentKernel_apply]
cases hrole : p.alice n (p.publicFrom n s) with
| true =>
simp only [↓reduceIte]
exact eA.active_mean n _ i j
| false =>
simp only [Bool.false_eq_true,↓reduceIte]
change (∫ o, eA.reference (n+1) (localPassive
(p.extractPrivate true n s,p.publicFrom n s)
(p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i j
∂κB n (p.extractPrivate false n s,p.publicFrom n s)) = _
simp only [eA.passive_reference]
simp
omit inst6604_15 in
lemma globalLocalReferenceB_mean [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) (i j : η) :
(∫ o, globalLocalReferenceB p κB eB (n+1) (Fin.snoc s o) i j
∂p.instrumentKernel κA κB n s) = globalLocalReferenceB p κB eB n s i j := by
unfold globalLocalReferenceB
simp_rw [p.extractPrivate_snoc, p.publicFrom_snoc]
rw [p.instrumentKernel_apply]
cases hrole : p.alice n (p.publicFrom n s) with
| false =>
simp only [↓reduceIte]
exact eB.active_mean n _ i j
| true =>
simp only [Bool.true_eq_false,↓reduceIte]
change (∫ o, eB.reference (n+1) (localPassive
(p.extractPrivate false n s,p.publicFrom n s)
(p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i j
∂κA n (p.extractPrivate true n s,p.publicFrom n s)) = _
simp only [eB.passive_reference]
simp
def jointReference (n : ℕ) (s : Fin n → O) : Matrix (ι × η) (ι × η) ℂ :=
globalLocalReferenceA p κA eA n s ⊗ₖ globalLocalReferenceB p κB eB n s
omit inst6604_14 inst6604_15 in
lemma jointReference_density [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) :
Density (jointReference p κA κB eA eB n s) := by
refine ⟨(eA.reference_density n _).1.kronecker (eB.reference_density n _).1,?_⟩
simp only [jointReference, Matrix.trace_kronecker,globalLocalReferenceA,
globalLocalReferenceB,(eA.reference_density n _).2,(eB.reference_density n _).2,one_mul]
lemma jointReference_measurable (n : ℕ) :
Measurable (jointReference p κA κB eA eB n) := by
have hm : Measurable (fun s i j => jointReference p κA κB eA eB n s i j) := by
apply Measurable.of_eval; intro i
apply Measurable.of_eval; intro j
exact (((Matrix.entryLinearMap ℂ ℂ i.1 j.1).toContinuousLinearMap).measurable.comp
(globalLocalReferenceA_measurable p κA eA n)).mul
(((Matrix.entryLinearMap ℂ ℂ i.2 j.2).toContinuousLinearMap).measurable.comp
(globalLocalReferenceB_measurable p κB eB n))
have hM : Continuous (Matrix.of : ((ι × η) → (ι × η) → ℂ) → Matrix (ι × η) (ι × η) ℂ) :=
continuous_matrix (fun i j => continuous_apply_apply i j)
exact hM.measurable.comp hm
omit inst6604_14 inst6604_15 in
lemma jointReference_mean [∀ n, IsMarkovKernel (κA n)] [∀ n, IsMarkovKernel (κB n)] (n : ℕ) (s : Fin n → O) (i j : ι × η) :
(∫ o, jointReference p κA κB eA eB (n+1) (Fin.snoc s o) i j
∂p.instrumentKernel κA κB n s) = jointReference p κA κB eA eB n s i j := by
change (∫ o, globalLocalReferenceA p κA eA (n+1) (Fin.snoc s o) i.1 j.1 *
globalLocalReferenceB p κB eB (n+1) (Fin.snoc s o) i.2 j.2
∂p.instrumentKernel κA κB n s) =
globalLocalReferenceA p κA eA n s i.1 j.1 * globalLocalReferenceB p κB eB n s i.2 j.2
simp only [globalLocalReferenceA,globalLocalReferenceB]
simp_rw [p.extractPrivate_snoc,p.publicFrom_snoc]
rw [p.instrumentKernel_apply]
cases hrole : p.alice n (p.publicFrom n s) with
| true =>
simp only [Bool.true_eq_false,↓reduceIte]
change (∫ o, eA.reference (n+1) (localActive
(p.extractPrivate true n s,p.publicFrom n s) o
(p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i.1 j.1 *
eB.reference (n+1) (localPassive (p.extractPrivate false n s,p.publicFrom n s)
(p.sendA n ((p.extractPrivate true n s,p.publicFrom n s),o))) i.2 j.2
∂κA n (p.extractPrivate true n s,p.publicFrom n s)) = _
simp_rw [eB.passive_reference]
rw [integral_mul_const,eA.active_mean]
| false =>
simp only [Bool.false_eq_true,↓reduceIte]
change (∫ o, eA.reference (n+1) (localPassive
(p.extractPrivate true n s,p.publicFrom n s)
(p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i.1 j.1 *
eB.reference (n+1) (localActive (p.extractPrivate false n s,p.publicFrom n s) o
(p.sendB n ((p.extractPrivate false n s,p.publicFrom n s),o))) i.2 j.2
∂κB n (p.extractPrivate false n s,p.publicFrom n s)) = _
simp_rw [eA.passive_reference]
rw [integral_const_mul,eB.active_mean]
end AdaptiveQuantum
section
open MeasureTheory ProbabilityTheory Set Function unitInterval
theorem paired_tapes_law :
(uniformTapeLaw.prod uniformTapeLaw).map
(fun uv : UniformTape × UniformTape => fun n => (uv.1 n,uv.2 n)) =
noiseTapeLaw ((volume : Measure I).prod volume) := by
let ν : Measure ((Fin 2 × ℕ) → I) := Measure.infinitePi (fun _ => (volume : Measure I))
let split : ((Fin 2 × ℕ) → I) → UniformTape × UniformTape :=
fun u => (fun n => u (0,n),fun n => u (1,n))
have hs : Measurable split := by fun_prop
have hsplit : ν.map split = uniformTapeLaw.prod uniformTapeLaw := by
have hc := Measure.infinitePi_map_curry (fun (_ : Fin 2) (_ : ℕ) => (volume : Measure I))
change ν.map (MeasurableEquiv.curry (Fin 2) ℕ I) =
Measure.infinitePi (fun _ : Fin 2 => uniformTapeLaw) at hc
rw [Measure.infinitePi_eq_pi (fun _ : Fin 2 => uniformTapeLaw)] at hc
have h := congrArg (fun P : Measure (Fin 2 → UniformTape) => P.map MeasurableEquiv.finTwoArrow) hc
rw [Measure.map_map (MeasurableEquiv.measurable _) (MeasurableEquiv.measurable _),
(measurePreserving_finTwoArrow uniformTapeLaw).map_eq] at h
exact h
have hswap := Measure.map_infinitePi_infinitePi_of_inj
(P := fun _ : Fin 2 × ℕ => (volume : Measure I))
(f := fun p : ℕ × Fin 2 => (p.2,p.1)) (by intro a b h; cases a; cases b; simpa only [Prod.mk.injEq,and_comm] using h)
have hc := Measure.infinitePi_map_curry (fun (_ : ℕ) (_ : Fin 2) => (volume : Measure I))
have hp := Measure.infinitePi_map_pi (fun _ : ℕ => Measure.infinitePi (fun _ : Fin 2 => (volume : Measure I)))
(f := fun _ => MeasurableEquiv.finTwoArrow) (fun _ => MeasurableEquiv.measurable _)
simp only [Measure.infinitePi_eq_pi, (measurePreserving_finTwoArrow (volume : Measure I)).map_eq] at hp
rw [← hsplit, Measure.map_map (by fun_prop) hs]
unfold noiseTapeLaw
rw [Measure.infinitePi_eq_pi (fun _ : Fin 2 => (volume : Measure I))] at hc
rw [← hp, ← hc, ← hswap]
rw [Measure.map_map (by fun_prop) (by fun_prop),Measure.map_map (by fun_prop) (by fun_prop)]
rfl
end
section
open MeasureTheory ProbabilityTheory
universe v6786_0 v6786_1 v6786_2 v6786_3 v6786_4
theorem condIndepFun_of_joint_law {Ω : Type v6786_0} {Ω' : Type v6786_1} {T : Type v6786_2} {A : Type v6786_3} {B : Type v6786_4}
[MeasurableSpace Ω] [StandardBorelSpace Ω]
[MeasurableSpace Ω'] [StandardBorelSpace Ω']
[MeasurableSpace T] [MeasurableSpace A] [StandardBorelSpace A] [Nonempty A]
[MeasurableSpace B] [StandardBorelSpace B] [Nonempty B]
{P : Measure Ω} {Q : Measure Ω'} [IsFiniteMeasure P] [IsFiniteMeasure Q]
{t : Ω → T} {a : Ω → A} {b : Ω → B}
{t' : Ω' → T} {a' : Ω' → A} {b' : Ω' → B}
(ht : Measurable t) (ha : Measurable a) (hb : Measurable b)
(ht' : Measurable t') (ha' : Measurable a') (hb' : Measurable b')
(hlaw : P.map (fun x => (t x,a x,b x)) = Q.map (fun x => (t' x,a' x,b' x)))
(hind : CondIndepFun (MeasurableSpace.comap t' inferInstance) ht'.comap_le a' b' Q) :
CondIndepFun (MeasurableSpace.comap t inferInstance) ht.comap_le a b P := by
have hm : Measurable (fun x => (t x,a x,b x)) := ht.prodMk (ha.prodMk hb)
have hm' : Measurable (fun x => (t' x,a' x,b' x)) := ht'.prodMk (ha'.prodMk hb')
have hT : P.map t = Q.map t' := by
have h := congrArg (fun ν : Measure (T × A × B) => ν.map Prod.fst) hlaw
simpa only [Measure.map_map measurable_fst hm,
Measure.map_map measurable_fst hm', Function.comp_def] using h
have hA : P.map (fun x => (t x,a x)) = Q.map (fun x => (t' x,a' x)) := by
have hp : Measurable (fun x : T × A × B => (x.1,x.2.1)) := by fun_prop
have h := congrArg (fun ν : Measure (T × A × B) => ν.map (fun x => (x.1,x.2.1))) hlaw
simpa only [Measure.map_map hp hm, Measure.map_map hp hm', Function.comp_def] using h
have hB : P.map (fun x => (t x,b x)) = Q.map (fun x => (t' x,b' x)) := by
have hp : Measurable (fun x : T × A × B => (x.1,x.2.2)) := by fun_prop
have h := congrArg (fun ν : Measure (T × A × B) => ν.map (fun x => (x.1,x.2.2))) hlaw
simpa only [Measure.map_map hp hm, Measure.map_map hp hm', Function.comp_def] using h
rw [condIndepFun_iff_map_prod_eq_prod_condDistrib_prod_condDistrib ha hb ht]
rw [condIndepFun_iff_map_prod_eq_prod_condDistrib_prod_condDistrib ha' hb' ht'] at hind
have hca : condDistrib a t P = condDistrib a' t' Q := by
rw [condDistrib, condDistrib]
congr 1
have hcb : condDistrib b t P = condDistrib b' t' Q := by
rw [condDistrib, condDistrib]
congr 1
rw [hlaw,hca,hcb,hT]
exact hind
end
namespace AdaptiveOutcomeSampler
open MeasureTheory ProbabilityTheory Set Function unitInterval
universe v6835_0 v6835_1
variable {O : Type v6835_0} {M : Type v6835_1} [inst6835_0 : MeasurableSpace O] [inst6835_1 : MeasurableSpace M]
(p : AdaptiveOutcomeSampler O M)
def privateRecord (a : Bool) (pair : UniformTape × (ℕ → M)) (n : ℕ) : O ⊕ Unit :=
p.privatePrefix a (n+1) (pair.1,fun i => pair.2 i) (Fin.last n)
lemma measurable_privateRecord (a : Bool) : Measurable (p.privateRecord a) := by
apply Measurable.of_eval
intro n
exact ((p.measurable_privatePrefix a (n+1)).comp (by fun_prop)).eval (a := Fin.last n)
universe v6846_0 v6846_1
theorem final_records_independent [Nonempty M] {A : Type v6846_0} {B : Type v6846_1} [MeasurableSpace A] [MeasurableSpace B]
(readA : (ℕ → (O ⊕ Unit)) × (ℕ → M) → A)
(readB : (ℕ → (O ⊕ Unit)) × (ℕ → M) → B)
(ha : Measurable readA) (hb : Measurable readB) :
CondIndepFun (MeasurableSpace.comap p.tapeProgram.record inferInstance)
p.tapeProgram.measurable_record.comap_le
(fun uv => readA (p.privateRecord true (uv.1,p.tapeProgram.record uv),p.tapeProgram.record uv))
(fun uv => readB (p.privateRecord false (uv.2,p.tapeProgram.record uv),p.tapeProgram.record uv))
(uniformTapeLaw.prod uniformTapeLaw) := by
exact p.tapeProgram.final_records_conditionally_independent uniformTapeLaw uniformTapeLaw
(fun pair => readA (p.privateRecord true pair,pair.2))
(fun pair => readB (p.privateRecord false pair,pair.2))
(ha.comp ((p.measurable_privateRecord true).prodMk measurable_snd))
(hb.comp ((p.measurable_privateRecord false).prodMk measurable_snd))
def outcomeRecord (uv : UniformTape × UniformTape) : ℕ → O :=
p.causal.record (pairedTape uv)
lemma measurable_outcomeRecord : Measurable p.outcomeRecord :=
p.causal.measurable_record.comp measurable_pairedTape
lemma outcomeRecord_law (κ : (n : ℕ) → Kernel (Fin n → O) O)
[∀ n, IsMarkovKernel (κ n)]
(hlaw : ∀ n s, (volume.prod volume).map (fun u => p.causal.step n (s,u)) = κ n s)
(P : Measure (ℕ → O)) [IsProbabilityMeasure P]
(hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) =
((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) :
(uniformTapeLaw.prod uniformTapeLaw).map p.outcomeRecord = P := by
rw [p.causal.record_law_unique κ hlaw P hP]
change (uniformTapeLaw.prod uniformTapeLaw).map (p.causal.record ∘ pairedTape) = _
rw [← Measure.map_map p.causal.measurable_record measurable_pairedTape]
congr 1
exact paired_tapes_law
def publicRecord (x : ℕ → O) (n : ℕ) : M :=
p.publicFrom (n+1) (fun i => x i) (Fin.last n)
def localRecord (a : Bool) (x : ℕ → O) (n : ℕ) : O ⊕ Unit :=
p.extractPrivate a (n+1) (fun i => x i) (Fin.last n)
lemma measurable_publicRecord : Measurable p.publicRecord := by
apply Measurable.of_eval
intro n
exact ((p.measurable_publicFrom (n+1)).comp (by fun_prop)).eval (a := Fin.last n)
lemma measurable_localRecord (a : Bool) : Measurable (p.localRecord a) := by
apply Measurable.of_eval
intro n
exact ((p.measurable_extractPrivate a (n+1)).comp (by fun_prop)).eval (a := Fin.last n)
lemma publicRecord_replay (uv : UniformTape × UniformTape) :
p.publicRecord (p.outcomeRecord uv) = p.tapeProgram.record uv := by
funext n
have h := congrFun (p.replay_matches (n+1) uv).1 (Fin.last n)
have he : (fun i : Fin (n+1) => p.outcomeRecord uv i) =
p.causal.history (n+1) (pairedTape uv) := by
funext i
exact (p.causal.prefix_eq_record (n+1) (pairedTape uv) i).symm
change p.publicFrom (n+1) (fun i => p.outcomeRecord uv i) (Fin.last n) = _
rw [he,h,p.tapeProgram.prefix_eq_record]
rfl
lemma localRecord_replay (a : Bool) (uv : UniformTape × UniformTape) :
p.localRecord a (p.outcomeRecord uv) =
p.privateRecord a ((if a then uv.1 else uv.2),p.tapeProgram.record uv) := by
funext n
have h := congrFun ((p.replay_matches (n+1) uv).2 a) (Fin.last n)
have he : (fun i : Fin (n+1) => p.outcomeRecord uv i) =
p.causal.history (n+1) (pairedTape uv) := by
funext i
exact (p.causal.prefix_eq_record (n+1) (pairedTape uv) i).symm
change p.extractPrivate a (n+1) (fun i => p.outcomeRecord uv i) (Fin.last n) = _
rw [he,h]
congr 2
funext i
exact p.tapeProgram.prefix_eq_record (n+1) uv i
universe v6928_0 v6928_1
theorem full_readout_law {A : Type v6928_0} {B : Type v6928_1} [MeasurableSpace A] [MeasurableSpace B]
(κ : (n : ℕ) → Kernel (Fin n → O) O) [∀ n, IsMarkovKernel (κ n)]
(hlaw : ∀ n s, (volume.prod volume).map (fun u => p.causal.step n (s,u)) = κ n s)
(P : Measure (ℕ → O)) [IsProbabilityMeasure P]
(hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) =
((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2))
(readA : (ℕ → (O ⊕ Unit)) × (ℕ → M) → A)
(readB : (ℕ → (O ⊕ Unit)) × (ℕ → M) → B)
(ha : Measurable readA) (hb : Measurable readB) :
P.map (fun x => (p.publicRecord x,
readA (p.localRecord true x,p.publicRecord x),
readB (p.localRecord false x,p.publicRecord x))) =
(uniformTapeLaw.prod uniformTapeLaw).map (fun uv => (p.tapeProgram.record uv,
readA (p.privateRecord true (uv.1,p.tapeProgram.record uv),p.tapeProgram.record uv),
readB (p.privateRecord false (uv.2,p.tapeProgram.record uv),p.tapeProgram.record uv))) := by
rw [← p.outcomeRecord_law κ hlaw P hP]
have hm : Measurable (fun x => (p.publicRecord x,
readA (p.localRecord true x,p.publicRecord x),
readB (p.localRecord false x,p.publicRecord x))) := by
exact p.measurable_publicRecord.prodMk
((ha.comp ((p.measurable_localRecord true).prodMk p.measurable_publicRecord)).prodMk
(hb.comp ((p.measurable_localRecord false).prodMk p.measurable_publicRecord)))
rw [Measure.map_map hm p.measurable_outcomeRecord]
congr 1
funext uv
simp only [Function.comp_def,p.publicRecord_replay,p.localRecord_replay,
Bool.false_eq_true,↓reduceIte]
universe v6957_0 v6957_1
theorem actual_records_independent [StandardBorelSpace O] [Nonempty M] {A : Type v6957_0} {B : Type v6957_1}
[MeasurableSpace A] [StandardBorelSpace A] [Nonempty A]
[MeasurableSpace B] [StandardBorelSpace B] [Nonempty B]
(κ : (n : ℕ) → Kernel (Fin n → O) O) [∀ n, IsMarkovKernel (κ n)]
(hlaw : ∀ n s, (volume.prod volume).map (fun u => p.causal.step n (s,u)) = κ n s)
(P : Measure (ℕ → O)) [IsProbabilityMeasure P]
(hP : ∀ n, P.map (fun x => fun i : Fin (n+1) => x i) =
((P.map (fun x => fun i : Fin n => x i)) ⊗ₘ κ n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2))
(readA : (ℕ → (O ⊕ Unit)) × (ℕ → M) → A)
(readB : (ℕ → (O ⊕ Unit)) × (ℕ → M) → B)
(ha : Measurable readA) (hb : Measurable readB) :
CondIndepFun (MeasurableSpace.comap p.publicRecord inferInstance)
p.measurable_publicRecord.comap_le
(fun x => readA (p.localRecord true x,p.publicRecord x))
(fun x => readB (p.localRecord false x,p.publicRecord x)) P := by
apply condIndepFun_of_joint_law p.measurable_publicRecord
(ha.comp ((p.measurable_localRecord true).prodMk p.measurable_publicRecord))
(hb.comp ((p.measurable_localRecord false).prodMk p.measurable_publicRecord))
p.tapeProgram.measurable_record
(ha.comp (((p.measurable_privateRecord true).comp
(measurable_fst.prodMk p.tapeProgram.measurable_record)).prodMk
p.tapeProgram.measurable_record))
(hb.comp (((p.measurable_privateRecord false).comp
(measurable_snd.prodMk p.tapeProgram.measurable_record)).prodMk
p.tapeProgram.measurable_record))
(p.full_readout_law κ hlaw P hP readA readB ha hb)
(p.final_records_independent readA readB ha hb)
end AdaptiveOutcomeSampler
section
open Matrix MeasureTheory ProbabilityTheory Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker Topology
universe v7004_0 v7004_1
variable {ι : Type v7004_0} {η : Type v7004_1} [inst7004_0 : Fintype ι] [inst7004_1 : Fintype η] [inst7004_2 : DecidableEq ι] [inst7004_3 : DecidableEq η]
omit inst7004_2 inst7004_3 in
lemma continuous_matrix_kronecker [DecidableEq ι] [DecidableEq η] : Continuous
(fun z : Matrix ι ι ℂ × Matrix η η ℂ => z.1 ⊗ₖ z.2) := by
apply continuous_matrix
intro i j
exact (((Matrix.entryLinearMap ℂ ℂ i.1 j.1).toContinuousLinearMap).continuous.comp
continuous_fst).mul
(((Matrix.entryLinearMap ℂ ℂ i.2 j.2).toContinuousLinearMap).continuous.comp
continuous_snd)
universe v7015_0
lemma measurable_matrix_kronecker {Ω : Type v7015_0} [MeasurableSpace Ω]
{U : Ω → Matrix ι ι ℂ} {V : Ω → Matrix η η ℂ}
(hU : Measurable U) (hV : Measurable V) :
Measurable (fun x => U x ⊗ₖ V x) :=
continuous_matrix_kronecker.measurable.comp (hU.prodMk hV)
omit inst7004_2 inst7004_3 in
lemma density_kronecker [DecidableEq ι] [DecidableEq η] {U : Matrix ι ι ℂ} {V : Matrix η η ℂ}
(hU : Density U) (hV : Density V) : Density (U ⊗ₖ V) := by
refine ⟨hU.1.kronecker hV.1,?_⟩
rw [Matrix.trace_kronecker,hU.2,hV.2,one_mul]
universe v7027_0
variable {Ω : Type v7027_0} {LA LB : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω}
{μ : Measure Ω} [inst7027_0 : IsFiniteMeasure μ] {F : Filtration ℕ mΩ}
theorem local_product_reference_extension
(U : ℕ → Ω → Matrix ι ι ℂ) (V : ℕ → Ω → Matrix η η ℂ)
(hU : ∀ n x, Density (U n x)) (hV : ∀ n x, Density (V n x))
(hLA : LA ≤ mΩ) (hLB : LB ≤ mΩ)
(hmU : ∀ n, Measurable[LA] (U n)) (hmV : ∀ n, Measurable[LB] (V n))
(hrU : ∀ i j, Martingale (fun n x => (U n x i j).re) F μ)
(hiU : ∀ i j, Martingale (fun n x => (U n x i j).im) F μ)
(hrV : ∀ i j, Martingale (fun n x => (V n x i j).re) F μ)
(hiV : ∀ i j, Martingale (fun n x => (V n x i j).im) F μ)
(hrUV : ∀ i j, Martingale (fun n x => ((U n x ⊗ₖ V n x) i j).re) F μ)
(hiUV : ∀ i j, Martingale (fun n x => ((U n x ⊗ₖ V n x) i j).im) F μ) :
∃ G : Ω → Matrix ι ι ℂ, ∃ H : Ω → Matrix η η ℂ,
Measurable[LA] G ∧ Measurable[LB] H ∧
(∀ x, Density (G x)) ∧ (∀ x, Density (H x)) ∧
(∀ᵐ x ∂μ, Tendsto (fun n => U n x) atTop (𝓝 (G x))) ∧
(∀ᵐ x ∂μ, Tendsto (fun n => V n x) atTop (𝓝 (H x))) ∧
(∀ n S, MeasurableSet[F n] S →
(∫ x in S, G x ∂μ) = ∫ x in S, U n x ∂μ) ∧
(∀ n S, MeasurableSet[F n] S →
(∫ x in S, H x ∂μ) = ∫ x in S, V n x ∂μ) ∧
∃ W : PositiveMatrixMeasure Ω (ι × η),
(∀ S, MeasurableSet S → W.value S = ∫ x in S, G x ⊗ₖ H x ∂μ) ∧
(∀ n S, MeasurableSet[F n] S →
W.value S = ∫ x in S, U n x ⊗ₖ V n x ∂μ) := by
obtain ⟨G,hGm,hG,hGi,hGt,hGc⟩ := local_reference_limit U hU hmU hLA hrU hiU
obtain ⟨H,hHm,hH,hHi,hHt,hHc⟩ := local_reference_limit V hV hmV hLB hrV hiV
obtain ⟨J,hJm,hJ,hJi,hJt,hJc⟩ := local_reference_limit
(fun n x => U n x ⊗ₖ V n x)
(fun n x => density_kronecker (hU n x) (hV n x))
(fun n => measurable_matrix_kronecker ((hmU n).mono hLA le_rfl)
((hmV n).mono hLB le_rfl)) le_rfl hrUV hiUV
have hprod : (fun x => G x ⊗ₖ H x) =ᵐ[μ] J := by
filter_upwards [hGt,hHt,hJt] with x hx hy hz
have ht : Tendsto (fun n => U n x ⊗ₖ V n x) atTop (𝓝 (G x ⊗ₖ H x)) :=
continuous_matrix_kronecker.continuousAt.tendsto.comp (hx.prodMk_nhds hy)
exact tendsto_nhds_unique ht hz
let W := positiveMatrixMeasureOfDensity hJi
(Eventually.of_forall (fun x => (hJ x).1))
refine ⟨G,H,hGm,hHm,hG,hH,hGt,hHt,hGc,hHc,W,?_,?_⟩
· intro S hS
rw [positiveMatrixMeasureOfDensity_value hJi _ S hS]
exact integral_congr_ae (ae_restrict_of_ae hprod.symm)
· intro n S hS
rw [positiveMatrixMeasureOfDensity_value hJi _ S (F.le n S hS)]
exact hJc n S hS
end
section
open Matrix MeasureTheory ProbabilityTheory Filter unitInterval
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker Topology
namespace AdaptiveOutcomeSampler
universe v7093_0 v7093_1
variable {O : Type v7093_0} {M : Type v7093_1} [inst7093_0 : MeasurableSpace O] [inst7093_1 : MeasurableSpace M]
(p : AdaptiveOutcomeSampler O M)
lemma publicFrom_eq_record (n : ℕ) (x : ℕ → O) (i : Fin n) :
p.publicFrom n (historyPrefix n x) i = p.publicRecord x i := by
induction n with
| zero => exact Fin.elim0 i
| succ n ih =>
refine Fin.lastCases ?_ (fun j => ?_) i
· rfl
· simp only [publicFrom,replay,Fin.snoc_castSucc]
exact ih j
lemma extractPrivate_eq_record (a : Bool) (n : ℕ) (x : ℕ → O) (i : Fin n) :
p.extractPrivate a n (historyPrefix n x) i = p.localRecord a x i := by
induction n with
| zero => exact Fin.elim0 i
| succ n ih =>
refine Fin.lastCases ?_ (fun j => ?_) i
· rfl
· cases a <;> simp only [extractPrivate,replay,Bool.false_eq_true,↓reduceIte,
Fin.snoc_castSucc] <;> exact ih j
abbrev localField (a : Bool) : MeasurableSpace (ℕ → O) :=
MeasurableSpace.comap (fun x => (p.localRecord a x,p.publicRecord x)) inferInstance
lemma localField_le (a : Bool) : p.localField a ≤ (inferInstance : MeasurableSpace (ℕ → O)) :=
((p.measurable_localRecord a).prodMk p.measurable_publicRecord).comap_le
lemma local_history_measurable (a : Bool) (n : ℕ) :
Measurable[p.localField a] (fun x =>
(p.extractPrivate a n (historyPrefix n x),p.publicFrom n (historyPrefix n x))) := by
have he : (fun x => (p.extractPrivate a n (historyPrefix n x),p.publicFrom n (historyPrefix n x))) =
fun x => ((fun i : Fin n => p.localRecord a x i),fun i : Fin n => p.publicRecord x i) := by
funext x
congr 1 <;> funext i
· exact p.extractPrivate_eq_record a n x i
· exact p.publicFrom_eq_record n x i
rw [he]
let : MeasurableSpace (ℕ → O) := p.localField a
have hm : Measurable (fun x : ℕ → O => (p.localRecord a x,p.publicRecord x)) :=
Measurable.of_comap_le le_rfl
exact (Measurable.of_eval (fun i => hm.fst.eval)).prodMk
(Measurable.of_eval (fun i => hm.snd.eval))
lemma localFields_independent [StandardBorelSpace O] [Nonempty O]
[StandardBorelSpace M] [Nonempty M]
(κ : (n : ℕ) → Kernel (Fin n → O) O) [∀ n, IsMarkovKernel (κ n)]
(hlaw : ∀ n s, ((volume : Measure I).prod volume).map
(fun u => p.causal.step n (s,u)) = κ n s)
(P : Measure (ℕ → O)) [IsProbabilityMeasure P]
(hP : ∀ n, P.map (historyPrefix (n+1)) =
((P.map (historyPrefix n)) ⊗ₘ κ n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) :
CondIndep (MeasurableSpace.comap p.publicRecord inferInstance)
(p.localField true) (p.localField false) p.measurable_publicRecord.comap_le P := by
classical
rw [condIndep_iff _ _ _ _ (p.localField_le true) (p.localField_le false)]
intro SA SB hSA hSB
obtain ⟨EA,hEA,rfl⟩ := hSA
obtain ⟨EB,hEB,rfl⟩ := hSB
let fa : (ℕ → O ⊕ Unit) × (ℕ → M) → Bool :=
fun x => if x ∈ EA then true else false
let fb : (ℕ → O ⊕ Unit) × (ℕ → M) → Bool :=
fun x => if x ∈ EB then true else false
have hfa : Measurable fa := measurable_const.ite hEA measurable_const
have hfb : Measurable fb := measurable_const.ite hEB measurable_const
have hi := p.actual_records_independent κ hlaw P hP fa fb hfa hfb
apply (condIndepFun_iff _ _ _ _
(hfa.comp ((p.measurable_localRecord true).prodMk p.measurable_publicRecord))
(hfb.comp ((p.measurable_localRecord false).prodMk p.measurable_publicRecord)) P).mp hi
· refine ⟨{true},measurableSet_singleton true,?_⟩
ext x
simp [fa]
· refine ⟨{true},measurableSet_singleton true,?_⟩
ext x
simp [fb]
end AdaptiveOutcomeSampler
namespace AdaptiveQuantum
open UnrestrictedQuantum
universe v7175_0 v7175_1 v7175_2 v7175_3 v7175_4 v7175_5
variable {O : Type v7175_0} {M : Type v7175_1} {ι : Type v7175_2} {η : Type v7175_3} [inst7175_0 : MeasurableSpace O] [inst7175_1 : MeasurableSpace M]
[inst7175_2 : Fintype ι] [inst7175_3 : Fintype η] [inst7175_4 : DecidableEq ι] [inst7175_5 : DecidableEq η]
{A : ℕ → Type v7175_4} {B : ℕ → Type v7175_5}
[inst7175_6 : ∀ n, AddCommGroup (A n)] [inst7175_7 : ∀ n, Module ℂ (A n)] [inst7175_8 : ∀ n, One (A n)] [inst7175_9 : ∀ n, LE (A n)]
[inst7175_10 : ∀ n, AddCommGroup (B n)] [inst7175_11 : ∀ n, Module ℂ (B n)] [inst7175_12 : ∀ n, One (B n)] [inst7175_13 : ∀ n, LE (B n)]
(p : AdaptiveOutcomeSampler O M)
(κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O)
[inst7175_14 : ∀ n, IsMarkovKernel (κA n)] [inst7175_15 : ∀ n, IsMarkovKernel (κB n)]
(eA : LocalObservableExecution (ι := ι) A κA p.sendA)
(eB : LocalObservableExecution (ι := η) B κB p.sendB)
theorem full_reference_extension
(P : Measure (ℕ → O)) [IsProbabilityMeasure P]
(hP : ∀ n, P.map (historyPrefix (n+1)) =
((P.map (historyPrefix n)) ⊗ₘ p.instrumentKernel κA κB n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2)) :
∃ G : (ℕ → O) → Matrix ι ι ℂ, ∃ H : (ℕ → O) → Matrix η η ℂ,
Measurable[p.localField true] G ∧ Measurable[p.localField false] H ∧
(∀ x, Density (G x)) ∧ (∀ x, Density (H x)) ∧
(∀ n S, MeasurableSet[historyFiltration n] S →
(∫ x in S, G x ∂P) = ∫ x in S, globalLocalReferenceA p κA eA n (historyPrefix n x) ∂P) ∧
(∀ n S, MeasurableSet[historyFiltration n] S →
(∫ x in S, H x ∂P) = ∫ x in S, globalLocalReferenceB p κB eB n (historyPrefix n x) ∂P) ∧
∃ W : PositiveMatrixMeasure (ℕ → O) (ι × η),
(∀ S, MeasurableSet S → W.value S = ∫ x in S, G x ⊗ₖ H x ∂P) ∧
(∀ n S, MeasurableSet[historyFiltration n] S →
W.value S = ∫ x in S, jointReference p κA κB eA eB n (historyPrefix n x) ∂P) := by
let U := globalLocalReferenceA p κA eA
let V := globalLocalReferenceB p κB eB
have hU (n : ℕ) (s : Fin n → O) : Density (U n s) := eA.reference_density n _
have hV (n : ℕ) (s : Fin n → O) : Density (V n s) := eB.reference_density n _
have hmU := globalLocalReferenceA_measurable p κA eA
have hmV := globalLocalReferenceB_measurable p κB eB
have hmeanU := globalLocalReferenceA_mean p κA κB eA
have hmeanV := globalLocalReferenceB_mean p κA κB eB
have hrU := reference_history_martingale_re P (p.instrumentKernel κA κB) hP U hU hmU hmeanU
have hiU := reference_history_martingale_im P (p.instrumentKernel κA κB) hP U hU hmU hmeanU
have hrV := reference_history_martingale_re P (p.instrumentKernel κA κB) hP V hV hmV hmeanV
have hiV := reference_history_martingale_im P (p.instrumentKernel κA κB) hP V hV hmV hmeanV
have hrUV := reference_history_martingale_re P (p.instrumentKernel κA κB) hP
(jointReference p κA κB eA eB) (jointReference_density p κA κB eA eB)
(jointReference_measurable p κA κB eA eB) (jointReference_mean p κA κB eA eB)
have hiUV := reference_history_martingale_im P (p.instrumentKernel κA κB) hP
(jointReference p κA κB eA eB) (jointReference_density p κA κB eA eB)
(jointReference_measurable p κA κB eA eB) (jointReference_mean p κA κB eA eB)
obtain ⟨G,H,hGm,hHm,hG,hH,_,_,hGc,hHc,W,hW,hWc⟩ :=
local_product_reference_extension
(fun n x => U n (historyPrefix n x)) (fun n x => V n (historyPrefix n x))
(fun n x => hU n _) (fun n x => hV n _) (p.localField_le true) (p.localField_le false)
(fun n => (eA.reference_measurable n).comp (p.local_history_measurable true n))
(fun n => (eB.reference_measurable n).comp (p.local_history_measurable false n))
hrU hiU hrV hiV hrUV hiUV
exact ⟨G,H,hGm,hHm,hG,hH,hGc,hHc,W,hW,hWc⟩
end AdaptiveQuantum
end
section
open MeasureTheory ProbabilityTheory Matrix
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
universe v7253_0
lemma condIndepFun_ae_indep_complex {Ω : Type v7253_0} {C : MeasurableSpace Ω}
{mΩ : MeasurableSpace Ω} [inst7253_0 : StandardBorelSpace Ω] {μ : Measure Ω}
[inst7253_1 : IsFiniteMeasure μ] (hC : C ≤ mΩ)
{f g : Ω → ℂ}
(hf : Measurable f) (hg : Measurable g)
(h : CondIndepFun C hC f g μ) :
∀ᵐ x ∂μ.trim hC, IndepFun f g (condExpKernel μ C x) := by
have he := (condIndepFun_iff_map_prod_eq_prod_map_map hf hg).mp h
filter_upwards [he] with x hx
apply (indepFun_iff_map_prod_eq_prod_map_map hf.aemeasurable hg.aemeasurable).mpr
simpa only [Kernel.prod_apply, Kernel.map_apply _ (hf.prodMk hg),
Kernel.map_apply _ hf, Kernel.map_apply _ hg] using hx
lemma condIndepFun_kernel_integral_mul {Ω : Type v7253_0} {C : MeasurableSpace Ω}
{mΩ : MeasurableSpace Ω} [inst7253_0 : StandardBorelSpace Ω] {μ : Measure Ω}
[inst7253_1 : IsFiniteMeasure μ] (hC : C ≤ mΩ)
{f g : Ω → ℂ}
(hf : Measurable f) (hg : Measurable g)
(h : CondIndepFun C hC f g μ) :
∀ᵐ x ∂μ.trim hC,
(∫ y, f y * g y ∂condExpKernel μ C x) =
(∫ y, f y ∂condExpKernel μ C x) *
(∫ y, g y ∂condExpKernel μ C x) := by
filter_upwards [condIndepFun_ae_indep_complex hC hf hg h] with x hx
exact hx.integral_fun_mul_eq_mul_integral hf.stronglyMeasurable.aestronglyMeasurable
hg.stronglyMeasurable.aestronglyMeasurable
universe v7283_0 v7283_1 v7283_2
variable {Ω : Type v7283_0} {ι : Type v7283_1} {κ : Type v7283_2} {C A B : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω}
[inst7283_0 : StandardBorelSpace Ω] [inst7283_1 : Fintype ι] [inst7283_2 : Fintype κ] [inst7283_3 : DecidableEq ι] [inst7283_4 : DecidableEq κ]
{μ : Measure Ω} [inst7283_5 : IsFiniteMeasure μ]
def publicMatrix (C : MeasurableSpace Ω) {mΩ : MeasurableSpace Ω}
[StandardBorelSpace Ω] (μ : Measure Ω) [IsFiniteMeasure μ]
(W : Ω → Matrix ι ι ℂ) (x : Ω) : Matrix ι ι ℂ :=
∫ y, W y ∂condExpKernel μ C x
lemma publicMatrix_measurable (_hC : C ≤ mΩ) {W : Ω → Matrix ι ι ℂ}
(hW : Measurable W) : Measurable[C] (publicMatrix C μ W) := by
exact hW.stronglyMeasurable.integral_condExpKernel.measurable
lemma publicMatrix_entry (W : Ω → Matrix ι ι ℂ)
(hWi : ∀ x, Integrable W (condExpKernel μ C x)) (x : Ω) (i j : ι) :
publicMatrix C μ W x i j = ∫ y, W y i j ∂condExpKernel μ C x :=
integral_matrix_entry (hWi x) i j
theorem condIndep_publicMatrix_kronecker
(hC : C ≤ mΩ) (hA : A ≤ mΩ) (hB : B ≤ mΩ)
(h : CondIndep C A B hC μ)
(U : Ω → Matrix ι ι ℂ) (V : Ω → Matrix κ κ ℂ)
(hUm : Measurable[A] U) (hVm : Measurable[B] V)
(hUi : ∀ x, Integrable U (condExpKernel μ C x))
(hVi : ∀ x, Integrable V (condExpKernel μ C x))
(hUVi : ∀ x, Integrable (fun y => U y ⊗ₖ V y) (condExpKernel μ C x)) :
publicMatrix C μ (fun y => U y ⊗ₖ V y) =ᵐ[μ.trim hC]
fun x => publicMatrix C μ U x ⊗ₖ publicMatrix C μ V x := by
have he (i j : ι) (k l : κ) :
∀ᵐ x ∂μ.trim hC,
(∫ y, U y i j * V y k l ∂condExpKernel μ C x) =
(∫ y, U y i j ∂condExpKernel μ C x) *
(∫ y, V y k l ∂condExpKernel μ C x) := by
have huf : Measurable[A] (fun y => U y i j) :=
((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).measurable.comp hUm
have hvf : Measurable[B] (fun y => V y k l) :=
((Matrix.entryLinearMap ℂ ℂ k l).toContinuousLinearMap).measurable.comp hVm
have hfg : CondIndepFun C hC (fun y => U y i j) (fun y => V y k l) μ := by
exact condIndep_of_condIndep_of_le_right
(condIndep_of_condIndep_of_le_left h huf.comap_le) hvf.comap_le
exact condIndepFun_kernel_integral_mul hC (huf.mono hA le_rfl)
(hvf.mono hB le_rfl) hfg
have he' := ae_all_iff.mpr (fun i => ae_all_iff.mpr (fun j =>
ae_all_iff.mpr (fun k => ae_all_iff.mpr (he i j k))))
filter_upwards [he'] with x hx
ext ⟨i,k⟩ ⟨j,l⟩
rw [publicMatrix_entry _ hUVi, Matrix.kronecker_apply,
publicMatrix_entry _ hUi, publicMatrix_entry _ hVi]
exact hx i j k l
end
section
open Matrix MeasureTheory ProbabilityTheory
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
universe v7361_0 v7361_1
variable {ι : Type v7361_0} {η : Type v7361_1} [inst7361_0 : Fintype ι] [inst7361_1 : Fintype η] [inst7361_2 : DecidableEq ι] [inst7361_3 : DecidableEq η]
def Subdensity (U : Matrix ι ι ℂ) : Prop := U.PosSemidef ∧ (trace U).re ≤ 1
omit inst7361_2 in
lemma subdensity_zero [DecidableEq ι] : Subdensity (0 : Matrix ι ι ℂ) := by
exact ⟨Matrix.PosSemidef.zero, by simp⟩
omit inst7361_2 inst7361_3 in
lemma subdensity_kronecker [DecidableEq ι] [DecidableEq η] {U : Matrix ι ι ℂ} {V : Matrix η η ℂ}
(hU : Subdensity U) (hV : Subdensity V) : Subdensity (U ⊗ₖ V) := by
refine ⟨hU.1.kronecker hV.1,?_⟩
have hUi : (trace U).im = 0 := (RCLike.nonneg_iff.mp hU.1.trace_nonneg).2
have hVi : (trace V).im = 0 := (RCLike.nonneg_iff.mp hV.1.trace_nonneg).2
rw [Matrix.trace_kronecker, Complex.mul_re,hUi,hVi,mul_zero,sub_zero]
exact (mul_le_of_le_one_left ((RCLike.nonneg_iff.mp hV.1.trace_nonneg).1) hU.2).trans hV.2
universe v7376_0
lemma integrable_subdensity {Ω : Type v7376_0} [MeasurableSpace Ω]
(U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Subdensity (U x)) (hm : Measurable U)
(μ : Measure Ω) [IsFiniteMeasure μ] : Integrable U μ := by
apply integrable_matrix_of_entries
intro i j
apply Integrable.of_bound
(((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).measurable.comp hm).aestronglyMeasurable 1
exact Filter.Eventually.of_forall (fun x =>
(psd_entry_norm_le_trace (hU x).1 i j).trans (hU x).2)
universe v7386_0
lemma integral_subdensity {Ω : Type v7386_0} [MeasurableSpace Ω]
(U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Subdensity (U x)) (hm : Measurable U)
(μ : Measure Ω) [IsProbabilityMeasure μ] : Subdensity (∫ x, U x ∂μ) := by
have hi := integrable_subdensity U hU hm μ
refine ⟨(integral_nonneg_of_ae (Filter.Eventually.of_forall
(fun x => (hU x).1.nonneg))).posSemidef,?_⟩
let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap
have htrace : trace (∫ x, U x ∂μ) = ∫ x, trace (U x) ∂μ := (L.integral_comp_comm hi).symm
rw [htrace]
change RCLike.re (∫ x, L (U x) ∂μ) ≤ 1
rw [← integral_re (L.integrable_comp hi)]
calc
_ ≤ ∫ _ : Ω, (1 : ℝ) ∂μ := integral_mono ((L.integrable_comp hi).re)
(integrable_const 1) (fun x => (hU x).2)
_ = 1 := by simp
universe v7402_0 v7402_1
lemma measurable_positive_factor {Ω : Type v7402_0} {T : Type v7402_1} [MeasurableSpace Ω]
[MeasurableSpace T] (r : Ω → T)
(U : Ω → Matrix ι ι ℂ) (hU : ∀ x, Subdensity (U x))
(hm : Measurable[MeasurableSpace.comap r inferInstance] U) :
∃ V : T → Matrix ι ι ℂ, Measurable V ∧ (∀ t, Subdensity (V t)) ∧ U = V ∘ r := by
classical
obtain ⟨V,hVm,hV⟩ := hm.exists_eq_measurable_comp
let good : Set T := {t | 0 ≤ V t ∧ (trace (V t)).re ≤ 1}
have hg : MeasurableSet good :=
(measurableSet_le measurable_const hVm).inter
(measurableSet_le (((Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap).measurable.comp hVm).re measurable_const)
let W : T → Matrix ι ι ℂ := good.piecewise V (fun _ => 0)
refine ⟨W,hVm.piecewise hg measurable_const,?_,?_⟩
· intro t
by_cases ht : t ∈ good
· simpa only [W,Set.piecewise_eq_of_mem good V _ ht] using
(show Subdensity (V t) from ⟨ht.1.posSemidef,ht.2⟩)
· simpa only [W,Set.piecewise_eq_of_notMem good V _ ht] using subdensity_zero (ι := ι)
· funext x
have he : U x = V (r x) := congrFun hV x
have hgx : r x ∈ good := by
change 0 ≤ V (r x) ∧ (trace (V (r x))).re ≤ 1
rw [← he]
exact ⟨(hU x).1.nonneg,(hU x).2⟩
simpa only [Function.comp_apply,W,Set.piecewise_eq_of_mem good V _ hgx] using he
universe v7429_0 v7429_1
variable {Ω : Type v7429_0} {T : Type v7429_1} {A B : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω}
[inst7429_0 : StandardBorelSpace Ω] [inst7429_1 : MeasurableSpace T]
{μ : Measure Ω} [inst7429_2 : IsFiniteMeasure μ]
(r : Ω → T) (hr : Measurable r)
theorem terminal_public_factors
(hA : A ≤ mΩ) (hB : B ≤ mΩ)
(h : CondIndep (MeasurableSpace.comap r inferInstance) A B hr.comap_le μ)
(U : Bool → Ω → Matrix ι ι ℂ) (V : Bool → Ω → Matrix η η ℂ)
(hU : ∀ i x, Subdensity (U i x)) (hV : ∀ j x, Subdensity (V j x))
(hmU : ∀ i, Measurable[A] (U i)) (hmV : ∀ j, Measurable[B] (V j)) :
∃ X : Bool → T → Matrix ι ι ℂ, ∃ Y : Bool → T → Matrix η η ℂ,
(∀ i, Measurable (X i)) ∧ (∀ j, Measurable (Y j)) ∧
(∀ i t, Subdensity (X i t)) ∧ (∀ j t, Subdensity (Y j t)) ∧
(∀ i j, publicMatrix (MeasurableSpace.comap r inferInstance) μ
(fun x => U i x ⊗ₖ V j x) =ᵐ[μ]
fun x => X i (r x) ⊗ₖ Y j (r x)) := by
have hUm (i : Bool) := (hmU i).mono hA le_rfl
have hVm (j : Bool) := (hmV j).mono hB le_rfl
have hpU (i : Bool) : ∀ x, Subdensity (publicMatrix (MeasurableSpace.comap r inferInstance) μ (U i) x) :=
fun x => integral_subdensity (U i) (hU i) (hUm i) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x)
have hpV (j : Bool) : ∀ x, Subdensity (publicMatrix (MeasurableSpace.comap r inferInstance) μ (V j) x) :=
fun x => integral_subdensity (V j) (hV j) (hVm j) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x)
choose X hXm hXp hX using fun i => measurable_positive_factor r
(publicMatrix (MeasurableSpace.comap r inferInstance) μ (U i)) (hpU i) (publicMatrix_measurable hr.comap_le (hUm i))
choose Y hYm hYp hY using fun j => measurable_positive_factor r
(publicMatrix (MeasurableSpace.comap r inferInstance) μ (V j)) (hpV j) (publicMatrix_measurable hr.comap_le (hVm j))
refine ⟨X,Y,hXm,hYm,hXp,hYp,?_⟩
intro i j
have he := condIndep_publicMatrix_kronecker hr.comap_le hA hB h
(U i) (V j) (hmU i) (hmV j)
(fun x => integrable_subdensity (U i) (hU i) (hUm i) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x))
(fun x => integrable_subdensity (V j) (hV j) (hVm j) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x))
(fun x => integrable_subdensity (fun y => U i y ⊗ₖ V j y)
(fun y => subdensity_kronecker (hU i y) (hV j y))
(measurable_matrix_kronecker (hUm i) (hVm j)) (condExpKernel μ (MeasurableSpace.comap r inferInstance) x))
have he' := ae_of_ae_trim hr.comap_le he
filter_upwards [he'] with x hx
exact hx.trans (by rw [congrFun (hX i) x,congrFun (hY j) x]; rfl)
end
open MeasureTheory Matrix Filter
open scoped ComplexOrder MatrixOrder
namespace PositiveMatrixMeasure
universe v7485_0 v7485_1
variable {Ω : Type v7485_0} {ι : Type v7485_1} {mΩ : MeasurableSpace Ω} [inst7485_0 : Fintype ι] [inst7485_1 : DecidableEq ι]
omit inst7485_1 in
lemma ext_on_generating_piSystem [DecidableEq ι] (W V : PositiveMatrixMeasure Ω ι) (C : Set (Set Ω))
(hC : IsPiSystem C) (hm : mΩ = MeasurableSpace.generateFrom C)
(h : ∀ S ∈ C, W.value S = V.value S) (hu : W.value Set.univ = V.value Set.univ) : W = V := by
have he : W.entry = V.entry := by
funext i j
refine VectorMeasure.ext_of_generateFrom C ?_ hm hC ?_
· intro S hS
exact congrArg (fun M : Matrix ι ι ℂ => M i j) (h S hS)
· exact congrArg (fun M : Matrix ι ι ℂ => M i j) hu
cases W
cases V
cases he
rfl
lemma ext_on_filtration (W V : PositiveMatrixMeasure Ω ι) (F : Filtration ℕ mΩ)
(hm : mΩ = ⨆ n, F n)
(h : ∀ n S, MeasurableSet[F n] S → W.value S = V.value S) : W = V := by
let C : Set (Set Ω) := {S | ∃ n, MeasurableSet[F n] S}
have hc : IsPiSystem C := by
intro S hS T hT _
obtain ⟨n,hn⟩ := hS
obtain ⟨k,hk⟩ := hT
exact ⟨max n k, ((F.mono (le_max_left n k)) S hn).inter ((F.mono (le_max_right n k)) T hk)⟩
have hgen : mΩ = MeasurableSpace.generateFrom C := by
rw [hm]
apply le_antisymm
· apply iSup_le; intro n S hS
exact MeasurableSpace.measurableSet_generateFrom ⟨n,hS⟩
· apply MeasurableSpace.generateFrom_le
rintro S ⟨n,hn⟩
exact (le_iSup (fun n => F n) n) S hn
exact W.ext_on_generating_piSystem V C hc hgen (fun S ⟨n,hn⟩ => h n S hn)
(h 0 Set.univ MeasurableSet.univ)
end PositiveMatrixMeasure
end ZeroKey
namespace UnrestrictedQuantum
open Matrix MeasureTheory
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator
universe v7551_0 v7551_1 v7551_2
variable {A : Type v7551_0} {B : Type v7551_1} {ι : Type v7551_2} [inst7551_0 : AddCommGroup A] [inst7551_1 : Module ℂ A] [inst7551_2 : One A] [inst7551_3 : LE A]
[inst7551_4 : AddCommGroup B] [inst7551_5 : Module ℂ B] [inst7551_6 : One B] [inst7551_7 : LE B]
[inst7551_8 : Fintype ι] [inst7551_9 : DecidableEq ι]
(J : ObservableInstrument Bool A B) (S : ReferenceFunctional A ι)
(r : InstrumentRun J S)
def bitReference (i : Bool) : Matrix ι ι ℂ := S (J.operation {i} 1)
omit inst7551_8 inst7551_9 in
lemma bitReference_positive [Fintype ι] [DecidableEq ι] (hS : PositiveFunctional S) (h1 : (0 : B) ≤ 1)
(i : Bool) : (bitReference J S i).PosSemidef :=
hS _ (J.positive {i} (measurableSet_singleton i) 1 h1)
omit inst7551_9 in
lemma bitReference_entry [DecidableEq ι] (i : Bool) (k l : ι) :
bitReference J S i k l = ∫ b in {i}, r.posterior b 1 k l ∂r.law :=
(r.update {i} (measurableSet_singleton i) 1 k l).symm
include r in
theorem bitReference_sum : bitReference J S false + bitReference J S true = S 1 := by
ext k l
rw [Matrix.add_apply, bitReference_entry J S r false,
bitReference_entry J S r true]
have hd : Disjoint ({false} : Set Bool) {true} := by simp
have hu : ({false} : Set Bool) ∪ {true} = Set.univ := by
ext b; cases b <;> simp
rw [← setIntegral_union hd (measurableSet_singleton true)
(r.integrable 1 k l).integrableOn (r.integrable 1 k l).integrableOn, hu,
Measure.restrict_univ]
exact InstrumentRun.reference_mean J S r k l
end UnrestrictedQuantum
section
open Matrix MeasureTheory ProbabilityTheory
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
namespace ZeroKey
universe v7614_0 v7614_1
variable {Ω : Type v7614_0} {ι : Type v7614_1} [inst7614_0 : Fintype ι] [inst7614_1 : DecidableEq ι]
{L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω}
{μ : Measure Ω} [inst7614_2 : IsFiniteMeasure μ]
omit inst7614_1 in
lemma density_subdensity [DecidableEq ι] {U : Matrix ι ι ℂ} (hU : Density U) : Subdensity U :=
⟨hU.1,by rw [hU.2]; norm_num⟩
theorem reference_density_unique_on_filtration (F : Filtration ℕ mΩ)
(hgen : mΩ = ⨆ n, F n)
(U V : Ω → Matrix ι ι ℂ)
(hU : ∀ x, Subdensity (U x)) (hV : ∀ x, Subdensity (V x))
(hmU : Measurable U) (hmV : Measurable V)
(hEq : ∀ n S, MeasurableSet[F n] S →
(∫ x in S, U x ∂μ) = ∫ x in S, V x ∂μ) : U =ᵐ[μ] V := by
have hUi := integrable_subdensity U hU hmU μ
have hVi := integrable_subdensity V hV hmV μ
have hUe (i j : ι) : Integrable (fun x => U x i j) μ :=
((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).integrable_comp hUi
have hVe (i j : ι) : Integrable (fun x => V x i j) μ :=
((Matrix.entryLinearMap ℂ ℂ i j).toContinuousLinearMap).integrable_comp hVi
let P := positiveMatrixMeasureOfDensity hUe
(Filter.Eventually.of_forall (fun x => (hU x).1))
let Q := positiveMatrixMeasureOfDensity hVe
(Filter.Eventually.of_forall (fun x => (hV x).1))
have hpq : P = Q := by
apply PositiveMatrixMeasure.ext_on_filtration P Q F hgen
intro n S hS
dsimp only [P,Q]
rw [positiveMatrixMeasureOfDensity_value hUe _ S (F.le n S hS),
positiveMatrixMeasureOfDensity_value hVe _ S (F.le n S hS)]
exact hEq n S hS
apply Integrable.ae_eq_of_forall_setIntegral_eq U V hUi hVi
intro S hS _
have he := congrArg (fun P : PositiveMatrixMeasure Ω ι => P.value S) hpq
dsimp only [P,Q] at he
simpa only [positiveMatrixMeasureOfDensity_value hUe _ S hS,
positiveMatrixMeasureOfDensity_value hVe _ S hS] using he
end ZeroKey
namespace UnrestrictedQuantum
universe v7657_0 v7657_1 v7657_2 v7657_3
variable {Ω : Type v7657_0} {ι : Type v7657_1} {A : Type v7657_2} {B : Type v7657_3} [inst7657_0 : Fintype ι] [inst7657_1 : DecidableEq ι]
{L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω}
[inst7657_2 : AddCommGroup A] [inst7657_3 : Module ℂ A] [inst7657_4 : One A] [inst7657_5 : LE A]
[inst7657_6 : AddCommGroup B] [inst7657_7 : Module ℂ B] [inst7657_8 : One B] [inst7657_9 : LE B]
(μ : Measure Ω) (F : Filtration ℕ mΩ)
(U : ℕ → Ω → Matrix ι ι ℂ)
structure IncomingObservableProcess where
state : Ω → ReferenceFunctional A ι
positive : ∀ x, PositiveFunctional (state x)
positive_unit : (0 : A) ≤ 1
normalized : ∀ x, trace (state x 1) = 1
local_measurable : Measurable[L] (fun x => state x 1)
causality : ∀ n S, MeasurableSet[F n] S →
(∫ x in S, state x 1 ∂μ) = ∫ x in S, U n x ∂μ
namespace IncomingObservableProcess
variable {μ F U} (e : IncomingObservableProcess (L := L) (A := A) μ F U)
lemma reference_density (x : Ω) : ZeroKey.Density (e.state x 1) :=
⟨e.positive x 1 e.positive_unit,e.normalized x⟩
structure BitReadout where
instrument : Ω → ObservableInstrument Bool A B
run : ∀ x, InstrumentRun (instrument x) (e.state x)
positive_unit : (0 : B) ≤ 1
local_measurable : ∀ i, Measurable[L] (fun x => bitReference (instrument x) (e.state x) i)
namespace BitReadout
variable {e}
variable (b : e.BitReadout (B := B))
def value (i : Bool) (x : Ω) : Matrix ι ι ℂ := bitReference (b.instrument x) (e.state x) i
lemma positive (i : Bool) (x : Ω) : (b.value i x).PosSemidef :=
bitReference_positive (b.instrument x) (e.state x) (e.positive x) b.positive_unit i
lemma sum (x : Ω) : b.value false x + b.value true x = e.state x 1 :=
bitReference_sum (b.instrument x) (e.state x) (b.run x)
lemma subdensity (i : Bool) (x : Ω) : ZeroKey.Subdensity (b.value i x) := by
refine ⟨b.positive i x,?_⟩
have hsum := congrArg (fun M : Matrix ι ι ℂ => (trace M).re) (b.sum x)
rw [Matrix.trace_add,Complex.add_re,e.normalized x,Complex.one_re] at hsum
have h0 := (RCLike.nonneg_iff.mp (b.positive false x).trace_nonneg).1
have h1 := (RCLike.nonneg_iff.mp (b.positive true x).trace_nonneg).1
change 0 ≤ (trace (b.value false x)).re at h0
change 0 ≤ (trace (b.value true x)).re at h1
cases i <;> linarith
lemma measurable (i : Bool) : Measurable[L] (b.value i) := b.local_measurable i
end BitReadout
end IncomingObservableProcess
end UnrestrictedQuantum
end
namespace ZeroKey
section
open Matrix MeasureTheory ProbabilityTheory
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
universe v7730_0 v7730_1 v7730_2 v7730_3
variable {Ω : Type v7730_0} {T : Type v7730_1} {ι : Type v7730_2} {η : Type v7730_3} {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω}
[inst7730_0 : StandardBorelSpace Ω] [inst7730_1 : MeasurableSpace T]
[inst7730_2 : Fintype ι] [inst7730_3 : Fintype η] [inst7730_4 : DecidableEq ι] [inst7730_5 : DecidableEq η]
{P : Measure Ω} [inst7730_6 : IsFiniteMeasure P]
lemma setIntegral_publicMatrix (hL : L ≤ mΩ) (U : Ω → Matrix ι ι ℂ)
(hU : Integrable U P) (S : Set Ω) (hS : MeasurableSet[L] S) :
(∫ x in S, publicMatrix L P U x ∂P) = ∫ x in S, U x ∂P := by
calc
_ = ∫ x in S, P[U | L] x ∂P := integral_congr_ae
(ae_restrict_of_ae (condExp_ae_eq_integral_condExpKernel hL hU).symm)
_ = _ := setIntegral_condExp hL hU hS
lemma public_factor_event (r : Ω → T) (hr : Measurable r)
(U : Ω → Matrix ι ι ℂ) (V : T → Matrix ι ι ℂ)
(hU : Integrable U P) (hV : Measurable V)
(he : publicMatrix (MeasurableSpace.comap r inferInstance) P U =ᵐ[P] V ∘ r)
(S : Set T) (hS : MeasurableSet S) :
(∫ t in S, V t ∂P.map r) = ∫ x in r ⁻¹' S, U x ∂P := by
rw [setIntegral_map hS hV.aestronglyMeasurable hr.aemeasurable]
calc
_ = ∫ x in r ⁻¹' S, publicMatrix (MeasurableSpace.comap r inferInstance) P U x ∂P :=
integral_congr_ae (ae_restrict_of_ae he.symm)
_ = _ := setIntegral_publicMatrix hr.comap_le U hU _ ⟨S,hS,rfl⟩
end
namespace AdaptiveQuantum
open Matrix MeasureTheory ProbabilityTheory Filter unitInterval
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker Topology
section
open UnrestrictedQuantum
universe v7771_0 v7771_1 v7771_2 v7771_3 v7771_4 v7771_5 v7771_6 v7771_7 v7771_8 v7771_9
variable {O : Type v7771_0} {M : Type v7771_1} {ι : Type v7771_2} {η : Type v7771_3} [inst7771_0 : MeasurableSpace O] [inst7771_1 : MeasurableSpace M]
[inst7771_2 : StandardBorelSpace O] [inst7771_3 : Nonempty O] [inst7771_4 : StandardBorelSpace M] [inst7771_5 : Nonempty M]
[inst7771_6 : Fintype ι] [inst7771_7 : Fintype η] [inst7771_8 : DecidableEq ι] [inst7771_9 : DecidableEq η]
{A : ℕ → Type v7771_4} {B : ℕ → Type v7771_5}
[inst7771_10 : ∀ n, AddCommGroup (A n)] [inst7771_11 : ∀ n, Module ℂ (A n)] [inst7771_12 : ∀ n, One (A n)] [inst7771_13 : ∀ n, LE (A n)]
[inst7771_14 : ∀ n, AddCommGroup (B n)] [inst7771_15 : ∀ n, Module ℂ (B n)] [inst7771_16 : ∀ n, One (B n)] [inst7771_17 : ∀ n, LE (B n)]
(p : AdaptiveOutcomeSampler O M)
(κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O)
[inst7771_18 : ∀ n, IsMarkovKernel (κA n)] [inst7771_19 : ∀ n, IsMarkovKernel (κB n)]
(eA : LocalObservableExecution (ι := ι) A κA p.sendA)
(eB : LocalObservableExecution (ι := η) B κB p.sendB)
{TA : Type v7771_6} {TB : Type v7771_7} {CA : Type v7771_8} {CB : Type v7771_9}
[inst7771_20 : AddCommGroup TA] [inst7771_21 : Module ℂ TA] [inst7771_22 : One TA] [inst7771_23 : LE TA]
[inst7771_24 : AddCommGroup TB] [inst7771_25 : Module ℂ TB] [inst7771_26 : One TB] [inst7771_27 : LE TB]
[inst7771_28 : AddCommGroup CA] [inst7771_29 : Module ℂ CA] [inst7771_30 : One CA] [inst7771_31 : LE CA]
[inst7771_32 : AddCommGroup CB] [inst7771_33 : Module ℂ CB] [inst7771_34 : One CB] [inst7771_35 : LE CB]
(P : Measure (ℕ → O)) [inst7771_36 : IsProbabilityMeasure P]
(hP : ∀ n, P.map (historyPrefix (n+1)) =
((P.map (historyPrefix n)) ⊗ₘ p.instrumentKernel κA κB n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2))
(eTA : IncomingObservableProcess (L := p.localField true) (A := TA) P historyFiltration
(fun n x => globalLocalReferenceA p κA eA n (historyPrefix n x)))
(eTB : IncomingObservableProcess (L := p.localField false) (A := TB) P historyFiltration
(fun n x => globalLocalReferenceB p κB eB n (historyPrefix n x)))
(bA : eTA.BitReadout (B := CA)) (bB : eTB.BitReadout (B := CB))
include hP
omit inst7771_2 inst7771_3 inst7771_4 inst7771_5 in
theorem incoming_joint_reference_consistency [StandardBorelSpace O] [Nonempty O] [StandardBorelSpace M] [Nonempty M] :
∀ n S, MeasurableSet[historyFiltration n] S →
(∫ x in S, (eTA.state x 1) ⊗ₖ (eTB.state x 1) ∂P) =
∫ x in S, jointReference p κA κB eA eB n (historyPrefix n x) ∂P := by
obtain ⟨G,H,hGm,hHm,hG,hH,hGc,hHc,W,hW,hWc⟩ :=
full_reference_extension p κA κB eA eB P hP
have hGa : (fun x => eTA.state x 1) =ᵐ[P] G :=
reference_density_unique_on_filtration historyFiltration historyFiltration_generates
(fun x => eTA.state x 1) G
(fun x => density_subdensity (eTA.reference_density x))
(fun x => density_subdensity (hG x))
(eTA.local_measurable.mono (p.localField_le true) le_rfl)
(hGm.mono (p.localField_le true) le_rfl)
(fun n S hS => (eTA.causality n S hS).trans (hGc n S hS).symm)
have hHa : (fun x => eTB.state x 1) =ᵐ[P] H :=
reference_density_unique_on_filtration historyFiltration historyFiltration_generates
(fun x => eTB.state x 1) H
(fun x => density_subdensity (eTB.reference_density x))
(fun x => density_subdensity (hH x))
(eTB.local_measurable.mono (p.localField_le false) le_rfl)
(hHm.mono (p.localField_le false) le_rfl)
(fun n S hS => (eTB.causality n S hS).trans (hHc n S hS).symm)
intro n S hS
rw [← hWc n S hS,hW S (historyFiltration.le n S hS)]
apply integral_congr_ae
filter_upwards [ae_restrict_of_ae hGa,ae_restrict_of_ae hHa] with x hx hy
rw [hx,hy]
theorem genuine_terminal_public_factors
(hlaw : ∀ n s, ((volume : Measure I).prod volume).map
(fun u => p.causal.step n (s,u)) = p.instrumentKernel κA κB n s) :
∃ X : Bool → (ℕ → M) → Matrix ι ι ℂ,
∃ Y : Bool → (ℕ → M) → Matrix η η ℂ,
(∀ i, Measurable (X i)) ∧ (∀ j, Measurable (Y j)) ∧
(∀ i t, Subdensity (X i t)) ∧ (∀ j t, Subdensity (Y j t)) ∧
∀ i j S, MeasurableSet S →
(∫ t in S, X i t ⊗ₖ Y j t ∂P.map p.publicRecord) =
∫ x in p.publicRecord ⁻¹' S, bA.value i x ⊗ₖ bB.value j x ∂P := by
obtain ⟨X,Y,hXm,hYm,hXp,hYp,hXY⟩ := terminal_public_factors p.publicRecord
p.measurable_publicRecord (p.localField_le true) (p.localField_le false)
(p.localFields_independent (p.instrumentKernel κA κB) hlaw P hP)
bA.value bB.value bA.subdensity bB.subdensity bA.measurable bB.measurable
refine ⟨X,Y,hXm,hYm,hXp,hYp,?_⟩
intro i j S hS
exact public_factor_event p.publicRecord p.measurable_publicRecord
(fun x => bA.value i x ⊗ₖ bB.value j x) (fun t => X i t ⊗ₖ Y j t)
(integrable_subdensity _ (fun x => subdensity_kronecker (bA.subdensity i x) (bB.subdensity j x))
(measurable_matrix_kronecker ((bA.measurable i).mono (p.localField_le true) le_rfl)
((bB.measurable j).mono (p.localField_le false) le_rfl)) P)
(measurable_matrix_kronecker (hXm i) (hYm j)) (hXY i j) S hS
end
open UnrestrictedQuantum
universe v7869_0 v7869_1 v7869_2 v7869_3 v7869_4 v7869_5 v7869_6 v7869_7 v7869_8 v7869_9
variable {O : Type v7869_0} {M : Type v7869_1} {ι : Type v7869_2} {η : Type v7869_3} [inst7869_0 : MeasurableSpace O] [inst7869_1 : MeasurableSpace M]
[inst7869_2 : StandardBorelSpace O] [inst7869_3 : Nonempty O] [inst7869_4 : StandardBorelSpace M] [inst7869_5 : Nonempty M]
[inst7869_6 : Fintype ι] [inst7869_7 : Fintype η] [inst7869_8 : DecidableEq ι] [inst7869_9 : DecidableEq η]
{A : ℕ → Type v7869_4} {B : ℕ → Type v7869_5}
[inst7869_10 : ∀ n, AddCommGroup (A n)] [inst7869_11 : ∀ n, Module ℂ (A n)] [inst7869_12 : ∀ n, One (A n)] [inst7869_13 : ∀ n, LE (A n)]
[inst7869_14 : ∀ n, AddCommGroup (B n)] [inst7869_15 : ∀ n, Module ℂ (B n)] [inst7869_16 : ∀ n, One (B n)] [inst7869_17 : ∀ n, LE (B n)]
(p : AdaptiveOutcomeSampler O M)
(κA κB : (n : ℕ) → Kernel (LocalHistory O M n) O)
[inst7869_18 : ∀ n, IsMarkovKernel (κA n)] [inst7869_19 : ∀ n, IsMarkovKernel (κB n)]
(eA : LocalObservableExecution (ι := ι) A κA p.sendA)
(eB : LocalObservableExecution (ι := η) B κB p.sendB)
{TA : Type v7869_6} {TB : Type v7869_7} {CA : Type v7869_8} {CB : Type v7869_9}
[inst7869_20 : AddCommGroup TA] [inst7869_21 : Module ℂ TA] [inst7869_22 : One TA] [inst7869_23 : LE TA]
[inst7869_24 : AddCommGroup TB] [inst7869_25 : Module ℂ TB] [inst7869_26 : One TB] [inst7869_27 : LE TB]
[inst7869_28 : AddCommGroup CA] [inst7869_29 : Module ℂ CA] [inst7869_30 : One CA] [inst7869_31 : LE CA]
[inst7869_32 : AddCommGroup CB] [inst7869_33 : Module ℂ CB] [inst7869_34 : One CB] [inst7869_35 : LE CB]
(P : Measure (ℕ → O)) [inst7869_36 : IsProbabilityMeasure P]
(hP : ∀ n, P.map (historyPrefix (n+1)) =
((P.map (historyPrefix n)) ⊗ₘ p.instrumentKernel κA κB n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2))
(eTA : IncomingObservableProcess (L := p.localField true) (A := TA) P historyFiltration
(fun n x => globalLocalReferenceA p κA eA n (historyPrefix n x)))
(eTB : IncomingObservableProcess (L := p.localField false) (A := TB) P historyFiltration
(fun n x => globalLocalReferenceB p κB eB n (historyPrefix n x)))
(bA : eTA.BitReadout (B := CA)) (bB : eTB.BitReadout (B := CB))
include hP
theorem terminal_reference_total :
(∫ x, bA.value false x ⊗ₖ bB.value false x ∂P) +
(∫ x, bA.value false x ⊗ₖ bB.value true x ∂P) +
(∫ x, bA.value true x ⊗ₖ bB.value false x ∂P) +
(∫ x, bA.value true x ⊗ₖ bB.value true x ∂P) =
jointReference p κA κB eA eB 0 Fin.elim0 := by
have hi (i j : Bool) : Integrable (fun x => bA.value i x ⊗ₖ bB.value j x) P :=
integrable_subdensity _ (fun x => subdensity_kronecker (bA.subdensity i x) (bB.subdensity j x))
(measurable_matrix_kronecker ((bA.measurable i).mono (p.localField_le true) le_rfl)
((bB.measurable j).mono (p.localField_le false) le_rfl)) P
have h2 := (integral_add ((hi false false).add (hi false true)) (hi true false)).symm
have h3 := (integral_add (((hi false false).add (hi false true)).add (hi true false)) (hi true true)).symm
simp only [Pi.add_apply] at h2 h3
rw [← integral_add (hi false false) (hi false true),h2,h3]
have hs (x : ℕ → O) : bA.value false x ⊗ₖ bB.value false x +
bA.value false x ⊗ₖ bB.value true x + bA.value true x ⊗ₖ bB.value false x +
bA.value true x ⊗ₖ bB.value true x = eTA.state x 1 ⊗ₖ eTB.state x 1 := by
rw [← bA.sum x,← bB.sum x,Matrix.add_kronecker,Matrix.kronecker_add,Matrix.kronecker_add]
abel
simp_rw [hs]
have hc := incoming_joint_reference_consistency p κA κB eA eB P hP eTA eTB
0 Set.univ MeasurableSet.univ
simp only [Measure.restrict_univ] at hc
rw [hc]
have he (x : ℕ → O) : historyPrefix 0 x = Fin.elim0 := Subsingleton.elim _ _
simp_rw [he]
simp
theorem terminal_public_normalization
(hlaw : ∀ n s, ((volume : Measure I).prod volume).map
(fun u => p.causal.step n (s,u)) = p.instrumentKernel κA κB n s) :
∃ X : Bool → (ℕ → M) → Matrix ι ι ℂ,
∃ Y : Bool → (ℕ → M) → Matrix η η ℂ,
(∀ i, Measurable (X i)) ∧ (∀ j, Measurable (Y j)) ∧
(∀ i t, Subdensity (X i t)) ∧ (∀ j t, Subdensity (Y j t)) ∧
(∀ i j S, MeasurableSet S →
(∫ t in S, X i t ⊗ₖ Y j t ∂P.map p.publicRecord) =
∫ x in p.publicRecord ⁻¹' S, bA.value i x ⊗ₖ bB.value j x ∂P) ∧
(∫ t, X false t ⊗ₖ Y false t ∂P.map p.publicRecord) +
(∫ t, X false t ⊗ₖ Y true t ∂P.map p.publicRecord) +
(∫ t, X true t ⊗ₖ Y false t ∂P.map p.publicRecord) +
(∫ t, X true t ⊗ₖ Y true t ∂P.map p.publicRecord) =
jointReference p κA κB eA eB 0 Fin.elim0 := by
obtain ⟨X,Y,hXm,hYm,hX,hY,hXY⟩ := genuine_terminal_public_factors
p κA κB eA eB P hP eTA eTB bA bB hlaw
refine ⟨X,Y,hXm,hYm,hX,hY,hXY,?_⟩
have ht (i j : Bool) := hXY i j Set.univ MeasurableSet.univ
simp only [Measure.restrict_univ,Set.preimage_univ] at ht
simp_rw [ht]
exact terminal_reference_total p κA κB eA eB P hP eTA eTB bA bB
end AdaptiveQuantum
section
open Matrix
open scoped ComplexOrder MatrixOrder Kronecker
universe v7966_0 v7966_1
variable {ι : Type v7966_0} {η : Type v7966_1} [inst7966_0 : Fintype ι] [inst7966_1 : Fintype η] [inst7966_2 : DecidableEq ι] [inst7966_3 : DecidableEq η]
lemma localProbe_reference :
keepReference (outer (localProbe (ι := ι)) localProbe) =
(Fintype.card ι : ℂ)⁻¹ • (1 : Matrix ι ι ℂ) := by
rw [localProbe,keepReference_vectorize]
simp only [Matrix.conjTranspose_smul,Matrix.conjTranspose_one,
Matrix.smul_mul,Matrix.mul_smul,one_mul,Matrix.transpose_smul,Matrix.transpose_one]
have hc : star (((Real.sqrt (Fintype.card ι : ℝ))⁻¹ : ℂ)) *
((Real.sqrt (Fintype.card ι : ℝ))⁻¹ : ℂ) = (Fintype.card ι : ℂ)⁻¹ := by
simp only [map_inv₀,Complex.star_def,Complex.conj_ofReal]
rw [← mul_inv,← Complex.ofReal_mul,Real.mul_self_sqrt (Nat.cast_nonneg _)]
simp
rw [smul_smul,mul_comm,hc]
lemma localProbe_reference_product :
keepReference (outer (localProbe (ι := ι)) localProbe) ⊗ₖ
keepReference (outer (localProbe (ι := η)) localProbe) =
keepReference (outer (localProbe (ι := ι × η)) localProbe) := by
simp only [localProbe_reference,Matrix.smul_kronecker,Matrix.kronecker_smul,
Matrix.one_kronecker_one,smul_smul,Fintype.card_prod,Nat.cast_mul,mul_inv]
rw [mul_comm]
end
section
open Matrix MeasureTheory ProbabilityTheory Function unitInterval
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
open UnrestrictedQuantum
universe v8064_0 v8064_1
structure Discussion (O : Type v8064_0) (M : Type v8064_1) [MeasurableSpace O] [MeasurableSpace M] where
alice : (n : ℕ) → (Fin n → M) → Bool
alice_measurable : ∀ n, Measurable (alice n)
kernelA : (n : ℕ) → Kernel (LocalHistory O M n) O
kernelB : (n : ℕ) → Kernel (LocalHistory O M n) O
markovA : ∀ n, IsMarkovKernel (kernelA n)
markovB : ∀ n, IsMarkovKernel (kernelB n)
sendA : (n : ℕ) → LocalHistory O M n × O → M
sendB : (n : ℕ) → LocalHistory O M n × O → M
sendA_measurable : ∀ n, Measurable (sendA n)
sendB_measurable : ∀ n, Measurable (sendB n)
namespace Discussion
universe v8077_0 v8077_1
variable {O : Type v8077_0} {M : Type v8077_1} [inst8077_0 : MeasurableSpace O] [inst8077_1 : MeasurableSpace M]
[inst8077_2 : StandardBorelSpace O] [inst8077_3 : Nonempty O] (d : Discussion O M)
attribute [instance] markovA markovB
def sampler : AdaptiveOutcomeSampler O M := by
have sample (n : ℕ) (κ : Kernel (LocalHistory O M n) O) [IsMarkovKernel κ] :
∃ f : LocalHistory O M n → I → O, Measurable (uncurry f) ∧
(∀ h, volume.map (f h) = κ h) ∧
∀ (μ : Measure (LocalHistory O M n)) [IsFiniteMeasure μ],
(μ.prod (volume : Measure I)).map (fun p => (p.1, f p.1 p.2)) = μ ⊗ₘ κ := by
obtain ⟨f, hf, hfLaw⟩ := κ.exists_measurable_map_eq_unitInterval
change Measurable (fun pair : LocalHistory O M n × I => f pair.1 pair.2) at hf
refine ⟨f, hf, hfLaw, ?_⟩
intro μ hμ
ext B hB
rw [Measure.map_apply (measurable_fst.prodMk hf) hB,
Measure.prod_apply (hB.preimage (measurable_fst.prodMk hf)),
Measure.compProd_apply hB]
congr 1
funext h
rw [← hfLaw h, Measure.map_apply hf.of_uncurry_left (measurable_prodMk_left hB)]
rfl
exact {
alice := d.alice
alice_meas := d.alice_measurable
sampleA n := uncurry (Classical.choose (sample n (d.kernelA n)))
sampleB n := uncurry (Classical.choose (sample n (d.kernelB n)))
sendA := d.sendA
sendB := d.sendB
sampleA_meas n := (Classical.choose_spec (sample n (d.kernelA n))).1
sampleB_meas n := (Classical.choose_spec (sample n (d.kernelB n))).1
sendA_meas := d.sendA_measurable
sendB_meas := d.sendB_measurable }
lemma sampler_law : ∀ n s, ((volume : Measure I).prod volume).map
(fun u => d.sampler.causal.step n (s,u)) =
d.sampler.instrumentKernel d.kernelA d.kernelB n s := by
apply d.sampler.causal_step_law
· intro n s
exact (Classical.choose_spec (sample_instrument_kernel (d.kernelA n))).2.1 s
· intro n s
exact (Classical.choose_spec (sample_instrument_kernel (d.kernelB n))).2.1 s
def probeLaw : Measure (ℕ → O) :=
(noiseTapeLaw ((volume : Measure I).prod volume)).map d.sampler.causalRecord
instance probeLaw_probability : IsProbabilityMeasure d.probeLaw :=
inferInstanceAs (IsProbabilityMeasure ((noiseTapeLaw ((volume : Measure I).prod volume)).map d.sampler.causal.record))
lemma probeLaw_prefix (n : ℕ) : d.probeLaw.map (historyPrefix (n+1)) =
((d.probeLaw.map (historyPrefix n)) ⊗ₘ
d.sampler.instrumentKernel d.kernelA d.kernelB n).map
(fun pair : (Fin n → O) × O => Fin.snoc (α := fun _ : Fin (n+1) => O) pair.1 pair.2) := by
have he (k : ℕ) : historyPrefix k ∘ d.sampler.causal.record =
d.sampler.causal.history k := by
funext u i
exact (d.sampler.causal.prefix_eq_record k u i).symm
simp only [probeLaw, AdaptiveOutcomeSampler.causalRecord_eq, Measure.map_map (measurable_historyPrefix _) d.sampler.causal.measurable_record,he]
exact d.sampler.causal.prefix_law_succ _ d.sampler_law n
def transcriptLaw : Measure (ℕ → M) := d.probeLaw.map d.sampler.publicRecord
instance transcriptLaw_probability : IsProbabilityMeasure d.transcriptLaw :=
inferInstanceAs (IsProbabilityMeasure (d.probeLaw.map d.sampler.publicRecord))
end Discussion
end
section
open scoped ComplexOrder MatrixOrder Kronecker
open Matrix
universe v8144_0 v8144_1
variable {ι : Type v8144_0} {κ : Type v8144_1} [inst8144_0 : Fintype ι] [inst8144_1 : Fintype κ] [inst8144_2 : DecidableEq ι] [inst8144_3 : DecidableEq κ]
lemma preparationFilter_product (R : Matrix (ι × κ) (ι × κ) ℂ)
(U : Matrix ι ι ℂ) (V : Matrix κ κ ℂ) :
preparationFilter R * (U ⊗ₖ V) * (preparationFilter R)ᴴ =
(CFC.sqrt R * (((Fintype.card ι : ℂ) • Uᵀ) ⊗ₖ ((Fintype.card κ : ℂ) • Vᵀ)) * CFC.sqrt R)ᵀ := by
have hs : (CFC.sqrt R)ᴴ = CFC.sqrt R := (CFC.sqrt_nonneg R).posSemidef.isHermitian.eq
have ht : ((CFC.sqrt R)ᵀ)ᴴ = (CFC.sqrt R)ᵀ := by
rw [Matrix.conjTranspose_transpose_eq_transpose_conjTranspose,hs]
have hc : (Real.sqrt (Fintype.card (ι × κ) : ℝ) : ℂ) *
(Real.sqrt (Fintype.card (ι × κ) : ℝ) : ℂ) =
(Fintype.card ι : ℂ)*(Fintype.card κ : ℂ) := by
rw [← Complex.ofReal_mul,Real.mul_self_sqrt (Nat.cast_nonneg _),
Fintype.card_prod,Nat.cast_mul]
simp
unfold preparationFilter
simp only [Matrix.conjTranspose_smul,Complex.star_def,Complex.conj_ofReal,ht,
smul_mul_assoc,mul_smul_comm,smul_smul,Matrix.transpose_mul,
← Matrix.kroneckerMap_transpose,Matrix.transpose_smul,Matrix.transpose_transpose,
Matrix.smul_kronecker,Matrix.kronecker_smul]
rw [hc]
congr 1
· ring
· exact Matrix.mul_assoc _ _ _
end
section
open scoped MatrixOrder ComplexOrder Kronecker
open Matrix
universe v8360_0
def eveBlock {ι : Type v8360_0} [inst8360_0 : Fintype ι] [inst8360_1 : DecidableEq ι]
(R D : Matrix ι ι ℂ) : Matrix ι ι ℂ := (CFC.sqrt R * D * CFC.sqrt R)ᵀ
open MeasureTheory
open scoped Matrix.Norms.L2Operator
universe v8632_0 v8632_1
variable {ι : Type v8632_0} {Ω : Type v8632_1} [inst8632_0 : Fintype ι] [inst8632_1 : DecidableEq ι] [inst8632_2 : MeasurableSpace Ω]
universe v8637_0
structure BitDensity (μ : Measure Ω) (ι : Type v8637_0) [Fintype ι] where
block : Bool → Bool → Ω → Matrix ι ι ℂ
positive : ∀ i j t, (block i j t).PosSemidef
measurable : ∀ i j, Measurable (block i j)
integrable : ∀ i j, Integrable (fun t => (trace (block i j t)).re) μ
normalized : (∫ t, (trace (block false false t)).re ∂μ) +
(∫ t, (trace (block false true t)).re ∂μ) +
(∫ t, (trace (block true false t)).re ∂μ) +
(∫ t, (trace (block true true t)).re ∂μ) = 1
def BitDensity.mass {μ : Measure Ω} (τ : BitDensity μ ι) (i j : Bool) : ℝ :=
∫ t, (trace (τ.block i j t)).re ∂μ
def BitDensity.idealBitError {μ : Measure Ω} (τ : BitDensity μ ι)
(σ : Ω → Matrix ι ι ℂ) : ℝ :=
τ.mass false true + τ.mass true false +
(∫ t, traceNorm (τ.block false false t - (1/2 : ℝ) • σ t) ∂μ) +
(∫ t, traceNorm (τ.block true true t - (1/2 : ℝ) • σ t) ∂μ)
end
section
open Matrix MeasureTheory ProbabilityTheory
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
section MatrixFiltering
universe v8879_0 v8879_1 v8879_2
variable {ι : Type v8879_0} {η : Type v8879_1} {Ω : Type v8879_2} [inst8879_0 : Fintype ι] [inst8879_1 : Fintype η] [inst8879_2 : DecidableEq ι] [inst8879_3 : DecidableEq η]
[inst8879_4 : MeasurableSpace Ω] {μ : Measure Ω}
def matrixFilterLinear (K : Matrix η ι ℂ) : Matrix ι ι ℂ →ₗ[ℂ] Matrix η η ℂ where
toFun U := K * U * Kᴴ
map_add' U V := by rw [Matrix.mul_add,Matrix.add_mul]
map_smul' c U := by simp only [Matrix.mul_smul,Matrix.smul_mul,RingHom.id_apply]
lemma integral_filter (K : Matrix η ι ℂ) {U : Ω → Matrix ι ι ℂ}
(hi : Integrable U μ) :
(∫ x, K * U x * Kᴴ ∂μ) = K * (∫ x, U x ∂μ) * Kᴴ :=
(matrixFilterLinear K).toContinuousLinearMap.integral_comp_comm hi
lemma integrable_filter (K : Matrix η ι ℂ) {U : Ω → Matrix ι ι ℂ}
(hi : Integrable U μ) : Integrable (fun x => K * U x * Kᴴ) μ :=
(matrixFilterLinear K).toContinuousLinearMap.integrable_comp hi
lemma integral_realTrace {U : Ω → Matrix ι ι ℂ} (hi : Integrable U μ) :
(∫ x, (trace (U x)).re ∂μ) = (trace (∫ x, U x ∂μ)).re := by
let L : Matrix ι ι ℂ →L[ℂ] ℂ := (Matrix.traceLinearMap ι ℂ ℂ).toContinuousLinearMap
change (∫ x, RCLike.re (L (U x)) ∂μ) = (L (∫ x,U x ∂μ)).re
rw [integral_re (L.integrable_comp hi)]
exact congrArg Complex.re (L.integral_comp_comm hi)
lemma preparationFilter_probe_reference [Nonempty ι]
(R : Matrix ι ι ℂ) (hR : R.PosSemidef) :
preparationFilter R * keepReference (outer (localProbe (ι := ι)) localProbe) *
(preparationFilter R)ᴴ = Rᵀ := by
rw [← keepReference_filter,preparation_filter_identity,canonical_reference R hR]
end MatrixFiltering
universe v8912_0 v8912_1 v8912_2
variable {ι : Type v8912_0} {η : Type v8912_1} {T : Type v8912_2} [inst8912_0 : Fintype ι] [inst8912_1 : Fintype η] [inst8912_2 : DecidableEq ι] [inst8912_3 : DecidableEq η]
[inst8912_4 : Nonempty ι] [inst8912_5 : Nonempty η] [inst8912_6 : MeasurableSpace T]
(μ : Measure T) [inst8912_7 : IsFiniteMeasure μ]
(X : Bool → T → Matrix ι ι ℂ) (Y : Bool → T → Matrix η η ℂ)
(hXm : ∀ i, Measurable (X i)) (hYm : ∀ j, Measurable (Y j))
(hX : ∀ i t, Subdensity (X i t)) (hY : ∀ j t, Subdensity (Y j t))
(R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R)
omit inst8912_4 inst8912_5 in
include hXm hYm hX hY in
lemma public_product_integrable [Nonempty ι] [Nonempty η] (i j : Bool) : Integrable (fun t => X i t ⊗ₖ Y j t) μ :=
integrable_subdensity _ (fun t => subdensity_kronecker (hX i t) (hY j t))
(measurable_matrix_kronecker (hXm i) (hYm j)) μ
def filteredPublicDensity
(hInit : (∫ t, X false t ⊗ₖ Y false t ∂μ) +
(∫ t, X false t ⊗ₖ Y true t ∂μ) +
(∫ t, X true t ⊗ₖ Y false t ∂μ) +
(∫ t, X true t ⊗ₖ Y true t ∂μ) =
keepReference (outer (localProbe (ι := ι × η)) localProbe)) : BitDensity μ (ι × η) where
block i j t := preparationFilter R * (X i t ⊗ₖ Y j t) * (preparationFilter R)ᴴ
positive i j t := ((hX i t).1.kronecker (hY j t).1).mul_mul_conjTranspose_same _
measurable i j := (matrixFilterLinear (preparationFilter R)).toContinuousLinearMap.measurable.comp
(measurable_matrix_kronecker (hXm i) (hYm j))
integrable i j := by
let L : Matrix (ι × η) (ι × η) ℂ →L[ℂ] ℂ :=
(Matrix.traceLinearMap (ι × η) ℂ ℂ).toContinuousLinearMap
exact (L.integrable_comp (integrable_filter _ (public_product_integrable μ X Y hXm hYm hX hY i j))).re
normalized := by
have hi (i j : Bool) := integrable_filter (preparationFilter R)
(public_product_integrable μ X Y hXm hYm hX hY i j)
rw [integral_realTrace (hi false false),integral_realTrace (hi false true),
integral_realTrace (hi true false),integral_realTrace (hi true true)]
simp_rw [integral_filter _ (public_product_integrable μ X Y hXm hYm hX hY _ _)]
rw [← Complex.add_re,← Matrix.trace_add,← Complex.add_re,← Matrix.trace_add,
← Complex.add_re,← Matrix.trace_add]
rw [← Matrix.add_mul,← Matrix.mul_add,← Matrix.add_mul,← Matrix.mul_add,
← Matrix.add_mul,← Matrix.mul_add,hInit,preparationFilter_probe_reference R hR.1,
Matrix.trace_transpose,hR.2]
rfl
lemma filteredPublicDensity_common_factors
(hInit : (∫ t, X false t ⊗ₖ Y false t ∂μ) +
(∫ t, X false t ⊗ₖ Y true t ∂μ) +
(∫ t, X true t ⊗ₖ Y false t ∂μ) +
(∫ t, X true t ⊗ₖ Y true t ∂μ) =
keepReference (outer (localProbe (ι := ι × η)) localProbe)) (i j : Bool) (t : T) :
(filteredPublicDensity μ X Y hXm hYm hX hY R hR hInit).block i j t =
eveBlock R (((Fintype.card ι : ℂ) • (X i t)ᵀ) ⊗ₖ ((Fintype.card η : ℂ) • (Y j t)ᵀ)) :=
preparationFilter_product R (X i t) (Y j t)
end
section
open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
open UnrestrictedQuantum
universe v8979_0 v8979_1 v8979_2 v8979_3 v8979_4 v8979_5 v8979_6 v8979_7 v8979_8 v8979_9
variable {O : Type v8979_0} {M : Type v8979_1} {ι : Type v8979_2} {η : Type v8979_3} [inst8979_0 : MeasurableSpace O] [inst8979_1 : MeasurableSpace M]
[inst8979_2 : StandardBorelSpace O] [inst8979_3 : Nonempty O] [inst8979_4 : StandardBorelSpace M] [inst8979_5 : Nonempty M]
[inst8979_6 : Fintype ι] [inst8979_7 : Fintype η] [inst8979_8 : DecidableEq ι] [inst8979_9 : DecidableEq η]
(d : Discussion O M)
(A : ℕ → Type v8979_4) (B : ℕ → Type v8979_5)
[inst8979_10 : ∀ n, AddCommGroup (A n)] [inst8979_11 : ∀ n, Module ℂ (A n)] [inst8979_12 : ∀ n, One (A n)] [inst8979_13 : ∀ n, LE (A n)]
[inst8979_14 : ∀ n, AddCommGroup (B n)] [inst8979_15 : ∀ n, Module ℂ (B n)] [inst8979_16 : ∀ n, One (B n)] [inst8979_17 : ∀ n, LE (B n)]
(TA : Type v8979_6) (TB : Type v8979_7) (CA : Type v8979_8) (CB : Type v8979_9)
[inst8979_18 : AddCommGroup TA] [inst8979_19 : Module ℂ TA] [inst8979_20 : One TA] [inst8979_21 : LE TA]
[inst8979_22 : AddCommGroup TB] [inst8979_23 : Module ℂ TB] [inst8979_24 : One TB] [inst8979_25 : LE TB]
[inst8979_26 : AddCommGroup CA] [inst8979_27 : Module ℂ CA] [inst8979_28 : One CA] [inst8979_29 : LE CA]
[inst8979_30 : AddCommGroup CB] [inst8979_31 : Module ℂ CB] [inst8979_32 : One CB] [inst8979_33 : LE CB]
structure BitProtocol where
executionA : LocalObservableExecution (ι := ι) A d.kernelA d.sendA
executionB : LocalObservableExecution (ι := η) B d.kernelB d.sendB
initialA : executionA.reference 0 (Fin.elim0,Fin.elim0) =
keepReference (outer (localProbe (ι := ι)) localProbe)
initialB : executionB.reference 0 (Fin.elim0,Fin.elim0) =
keepReference (outer (localProbe (ι := η)) localProbe)
incomingA : IncomingObservableProcess (L := d.sampler.localField true) (A := TA)
d.probeLaw historyFiltration
(fun n x => AdaptiveQuantum.globalLocalReferenceA d.sampler d.kernelA executionA n (historyPrefix n x))
incomingB : IncomingObservableProcess (L := d.sampler.localField false) (A := TB)
d.probeLaw historyFiltration
(fun n x => AdaptiveQuantum.globalLocalReferenceB d.sampler d.kernelB executionB n (historyPrefix n x))
readoutA : incomingA.BitReadout (B := CA)
readoutB : incomingB.BitReadout (B := CB)
variable {d A B TA TB CA CB}
namespace BitProtocol
variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB)
def completeReference (i j : Bool) (x : ℕ → O) : Matrix (ι × η) (ι × η) ℂ :=
p.readoutA.value i x ⊗ₖ p.readoutB.value j x
omit inst8979_4 inst8979_5 in
lemma completeReference_positive [StandardBorelSpace M] [Nonempty M] (i j : Bool) (x : ℕ → O) :
(p.completeReference i j x).PosSemidef :=
(p.readoutA.positive i x).kronecker (p.readoutB.positive j x)
omit inst8979_4 inst8979_5 in
lemma completeReference_measurable [StandardBorelSpace M] [Nonempty M] (i j : Bool) : Measurable (p.completeReference i j) :=
measurable_matrix_kronecker
((p.readoutA.measurable i).mono (d.sampler.localField_le true) le_rfl)
((p.readoutB.measurable j).mono (d.sampler.localField_le false) le_rfl)
lemma completeReference_integrable (i j : Bool) : Integrable (p.completeReference i j) d.probeLaw :=
integrable_subdensity _
(fun x => subdensity_kronecker (p.readoutA.subdensity i x) (p.readoutB.subdensity j x))
(p.completeReference_measurable i j) d.probeLaw
lemma completeReference_entry_integrable (i j : Bool) (k l : ι × η) :
Integrable (fun x => p.completeReference i j x k l) d.probeLaw :=
((Matrix.entryLinearMap ℂ ℂ k l).toContinuousLinearMap).integrable_comp
(p.completeReference_integrable i j)
def probeOutput (i j : Bool) : PositiveMatrixMeasure (ℕ → M) (ι × η) :=
(positiveMatrixMeasureOfDensity (p.completeReference_entry_integrable i j)
(Eventually.of_forall (p.completeReference_positive i j))).pushforward
d.sampler.publicRecord d.sampler.measurable_publicRecord
lemma probeOutput_event (i j : Bool) (S : Set (ℕ → M)) (hS : MeasurableSet S) :
(p.probeOutput i j).value S =
∫ x in d.sampler.publicRecord ⁻¹' S, p.completeReference i j x ∂d.probeLaw := by
rw [probeOutput,PositiveMatrixMeasure.pushforward_value _ _ _ S hS,
positiveMatrixMeasureOfDensity_value _ _ _ (d.sampler.measurable_publicRecord hS)]
omit inst8979_4 inst8979_5 in
lemma initial_joint_reference [StandardBorelSpace M] [Nonempty M] :
AdaptiveQuantum.jointReference d.sampler d.kernelA d.kernelB p.executionA p.executionB
0 Fin.elim0 = keepReference (outer (localProbe (ι := ι × η)) localProbe) := by
unfold AdaptiveQuantum.jointReference AdaptiveQuantum.globalLocalReferenceA
AdaptiveQuantum.globalLocalReferenceB
have ha : (d.sampler.extractPrivate true 0 Fin.elim0,d.sampler.publicFrom 0 Fin.elim0) =
(Fin.elim0,Fin.elim0) := Subsingleton.elim _ _
have hb : (d.sampler.extractPrivate false 0 Fin.elim0,d.sampler.publicFrom 0 Fin.elim0) =
(Fin.elim0,Fin.elim0) := Subsingleton.elim _ _
rw [ha,hb]
change p.executionA.reference 0 (Fin.elim0,Fin.elim0) ⊗ₖ
p.executionB.reference 0 (Fin.elim0,Fin.elim0) = _
rw [p.initialA,p.initialB,localProbe_reference_product]
theorem public_factors :
∃ X : Bool → (ℕ → M) → Matrix ι ι ℂ,
∃ Y : Bool → (ℕ → M) → Matrix η η ℂ,
(∀ i, Measurable (X i)) ∧ (∀ j, Measurable (Y j)) ∧
(∀ i t, Subdensity (X i t)) ∧ (∀ j t, Subdensity (Y j t)) ∧
(∀ i j S, MeasurableSet S → (p.probeOutput i j).value S =
∫ t in S, X i t ⊗ₖ Y j t ∂d.transcriptLaw) ∧
(∫ t, X false t ⊗ₖ Y false t ∂d.transcriptLaw) +
(∫ t, X false t ⊗ₖ Y true t ∂d.transcriptLaw) +
(∫ t, X true t ⊗ₖ Y false t ∂d.transcriptLaw) +
(∫ t, X true t ⊗ₖ Y true t ∂d.transcriptLaw) =
keepReference (outer (localProbe (ι := ι × η)) localProbe) := by
obtain ⟨X,Y,hXm,hYm,hX,hY,hXY,hn⟩ := AdaptiveQuantum.terminal_public_normalization
d.sampler d.kernelA d.kernelB p.executionA p.executionB d.probeLaw d.probeLaw_prefix
p.incomingA p.incomingB p.readoutA p.readoutB d.sampler_law
refine ⟨X,Y,hXm,hYm,hX,hY,?_,hn.trans p.initial_joint_reference⟩
intro i j S hS
exact (p.probeOutput_event i j S hS).trans (hXY i j S hS).symm
def canonicalOutput (R : Matrix (ι × η) (ι × η) ℂ) (i j : Bool) :
PositiveMatrixMeasure (ℕ → M) (ι × η) :=
(p.probeOutput i j).filter (preparationFilter R)
end BitProtocol
end
namespace PositiveMatrixMeasure
open MeasureTheory Matrix Filter
open scoped Matrix.Norms.L2Operator ComplexOrder MatrixOrder
universe v9237_0 v9237_1
variable {Ω : Type v9237_0} {ι : Type v9237_1} [inst9237_0 : MeasurableSpace Ω] [inst9237_1 : Fintype ι] [inst9237_2 : DecidableEq ι]
def positiveDensity (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) (t : Ω) : Matrix ι ι ℂ :=
by classical exact if (W.density μ t).PosSemidef then W.density μ t else 0
omit inst9237_2 in
lemma positiveDensity_pos [DecidableEq ι] (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) (t : Ω) :
(W.positiveDensity μ t).PosSemidef := by
unfold positiveDensity
split
· assumption
· exact Matrix.PosSemidef.zero
lemma measurable_positiveDensity (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) :
Measurable (W.positiveDensity μ) := by
have hm : MeasurableSet {t | (W.density μ t).PosSemidef} := by
have he : {t | (W.density μ t).PosSemidef} = (W.density μ) ⁻¹' Set.Ici 0 := by
ext t
exact Matrix.nonneg_iff_posSemidef.symm
rw [he]
exact (W.measurable_density μ) measurableSet_Ici
exact (W.measurable_density μ).ite hm measurable_const
lemma positiveDensity_ae (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω) [SigmaFinite μ]
(hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0) :
W.positiveDensity μ =ᵐ[μ] W.density μ := by
filter_upwards [density_posSemidef_ae W μ hAC] with t ht
exact ite_eq_left ht
lemma integrable_positiveDensity_trace (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω)
[SigmaFinite μ] (hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0) :
Integrable (fun t => (trace (W.positiveDensity μ t)).re) μ := by
apply (W.integrable_trace_density μ).re.congr
filter_upwards [W.positiveDensity_ae μ hAC] with t ht
rw [ht]
rfl
lemma integral_positiveDensity_trace (W : PositiveMatrixMeasure Ω ι) (μ : Measure Ω)
[SigmaFinite μ] (hAC : ∀ S, MeasurableSet S → μ S=0 → W.value S=0) :
(∫ t, (trace (W.positiveDensity μ t)).re ∂μ) = (trace (W.value Set.univ)).re := by
calc
_ = ∫ t, (trace (W.density μ t)).re ∂μ := by
apply integral_congr_ae
filter_upwards [W.positiveDensity_ae μ hAC] with t ht
rw [ht]
_ = (trace (W.value Set.univ)).re := by
change (∫ t, RCLike.re (trace (W.density μ t)) ∂μ) = _
rw [integral_re (W.integrable_trace_density μ)]
have he := W.integral_trace_density μ hAC Set.univ MeasurableSet.univ
change (∫ t, trace (W.density μ t) ∂μ).re = _
simpa only [Measure.restrict_univ] using congrArg Complex.re he
def toBitDensity (W : Bool → Bool → PositiveMatrixMeasure Ω ι)
(μ : Measure Ω) [SigmaFinite μ]
(hAC : ∀ i j S, MeasurableSet S → μ S=0 → (W i j).value S=0)
(hn : (trace ((W false false).value Set.univ)).re +
(trace ((W false true).value Set.univ)).re +
(trace ((W true false).value Set.univ)).re +
(trace ((W true true).value Set.univ)).re = 1) : BitDensity μ ι where
block i j := (W i j).positiveDensity μ
positive i j := (W i j).positiveDensity_pos μ
measurable i j := (W i j).measurable_positiveDensity μ
integrable i j := (W i j).integrable_positiveDensity_trace μ (hAC i j)
normalized := by
simp only [integral_positiveDensity_trace _ μ (hAC _ _)]
exact hn
end PositiveMatrixMeasure
section
open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
open UnrestrictedQuantum
universe v9409_0 v9409_1 v9409_2 v9409_3 v9409_4 v9409_5 v9409_6 v9409_7 v9409_8 v9409_9
variable {O : Type v9409_0} {M : Type v9409_1} {ι : Type v9409_2} {η : Type v9409_3} [inst9409_0 : MeasurableSpace O] [inst9409_1 : MeasurableSpace M]
[inst9409_2 : StandardBorelSpace O] [inst9409_3 : Nonempty O] [inst9409_4 : StandardBorelSpace M] [inst9409_5 : Nonempty M]
[inst9409_6 : Fintype ι] [inst9409_7 : Fintype η] [inst9409_8 : DecidableEq ι] [inst9409_9 : DecidableEq η]
[inst9409_10 : Nonempty ι] [inst9409_11 : Nonempty η]
{d : Discussion O M} {A : ℕ → Type v9409_4} {B : ℕ → Type v9409_5}
[inst9409_12 : ∀ n, AddCommGroup (A n)] [inst9409_13 : ∀ n, Module ℂ (A n)] [inst9409_14 : ∀ n, One (A n)] [inst9409_15 : ∀ n, LE (A n)]
[inst9409_16 : ∀ n, AddCommGroup (B n)] [inst9409_17 : ∀ n, Module ℂ (B n)] [inst9409_18 : ∀ n, One (B n)] [inst9409_19 : ∀ n, LE (B n)]
{TA : Type v9409_6} {TB : Type v9409_7} {CA : Type v9409_8} {CB : Type v9409_9}
[inst9409_20 : AddCommGroup TA] [inst9409_21 : Module ℂ TA] [inst9409_22 : One TA] [inst9409_23 : LE TA]
[inst9409_24 : AddCommGroup TB] [inst9409_25 : Module ℂ TB] [inst9409_26 : One TB] [inst9409_27 : LE TB]
[inst9409_28 : AddCommGroup CA] [inst9409_29 : Module ℂ CA] [inst9409_30 : One CA] [inst9409_31 : LE CA]
[inst9409_32 : AddCommGroup CB] [inst9409_33 : Module ℂ CB] [inst9409_34 : One CB] [inst9409_35 : LE CB]
namespace BitProtocol
variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB)
(R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R)
include hR
theorem canonical_density_representation :
∃ τ : BitDensity d.transcriptLaw (ι × η),
∃ X : Bool → (ℕ → M) → Matrix ι ι ℂ,
∃ Y : Bool → (ℕ → M) → Matrix η η ℂ,
(∀ i t, (X i t).PosSemidef) ∧ (∀ j t, (Y j t).PosSemidef) ∧
(∀ i j t, τ.block i j t = eveBlock R (X i t ⊗ₖ Y j t)) ∧
(∀ i j, Integrable (τ.block i j) d.transcriptLaw) ∧
(∀ i j S, MeasurableSet S → (p.canonicalOutput R i j).value S =
∫ t in S, τ.block i j t ∂d.transcriptLaw) := by
obtain ⟨X,Y,hXm,hYm,hX,hY,hXY,hn⟩ := p.public_factors
let τ := filteredPublicDensity d.transcriptLaw X Y hXm hYm hX hY R hR hn
refine ⟨τ,fun i t => (Fintype.card ι : ℂ) • (X i t)ᵀ,
fun j t => (Fintype.card η : ℂ) • (Y j t)ᵀ,?_,?_,?_,?_,?_⟩
· intro i t
exact (hX i t).1.transpose.smul (by exact_mod_cast Nat.zero_le (Fintype.card ι))
· intro j t
exact (hY j t).1.transpose.smul (by exact_mod_cast Nat.zero_le (Fintype.card η))
· exact filteredPublicDensity_common_factors d.transcriptLaw X Y hXm hYm hX hY R hR hn
· intro i j
exact integrable_filter _ (public_product_integrable d.transcriptLaw X Y hXm hYm hX hY i j)
· intro i j S hS
rw [canonicalOutput,PositiveMatrixMeasure.filter_value,hXY i j S hS]
exact (integral_filter _
((public_product_integrable d.transcriptLaw X Y hXm hYm hX hY i j).integrableOn)).symm
lemma canonicalOutput_normalized :
(trace ((p.canonicalOutput R false false).value Set.univ)).re +
(trace ((p.canonicalOutput R false true).value Set.univ)).re +
(trace ((p.canonicalOutput R true false).value Set.univ)).re +
(trace ((p.canonicalOutput R true true).value Set.univ)).re = 1 := by
obtain ⟨τ,X,Y,hX,hY,hτ,hi,he⟩ := p.canonical_density_representation R hR
simp_rw [he _ _ Set.univ MeasurableSet.univ,Measure.restrict_univ,← integral_realTrace (hi _ _)]
exact τ.normalized
end BitProtocol
end
section
open Matrix MeasureTheory
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator
universe v9682_0 v9682_1 v9682_2 v9682_3
variable {Ω : Type v9682_0} {ι : Type v9682_1} {K : Type v9682_2} {Λ : Type v9682_3} [inst9682_0 : MeasurableSpace Ω] [inst9682_1 : Fintype ι] [inst9682_2 : DecidableEq ι]
[inst9682_3 : Fintype K] [inst9682_4 : DecidableEq K] [inst9682_5 : Fintype Λ] [inst9682_6 : DecidableEq Λ] {μ : Measure Ω}
def cqDistance (W V : K → K → Ω → Matrix ι ι ℂ) (μ : Measure Ω) : ℝ :=
∑ a, ∑ b, ∫ t, traceNorm (W a b t - V a b t) ∂μ
def idealFiniteBlocks (sigma : Matrix ι ι ℂ) (a b : K) : Matrix ι ι ℂ :=
if a = b then (1/(Fintype.card K : ℝ)) • sigma else 0
end
section
open Matrix
open scoped ComplexOrder MatrixOrder Kronecker Matrix.Norms.L2Operator
universe v9922_0 v9922_1
variable {ι : Type v9922_0} {κ : Type v9922_1} [inst9922_0 : Fintype ι] [inst9922_1 : Fintype κ] [inst9922_2 : DecidableEq ι] [inst9922_3 : DecidableEq κ]
def compressReference (D : Matrix ι ι ℂ) :
Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ →ₗ[ℂ] Matrix ι ι ℂ where
toFun Z := Z.submatrix Sum.inr Sum.inr + trace (Z.submatrix Sum.inl Sum.inl) • D
map_add' Z W := by simp [Matrix.submatrix_add,Matrix.trace_add,add_smul]; abel
map_smul' c Z := by simp [Matrix.submatrix_smul,Matrix.trace_smul,smul_smul,smul_add]
omit inst9922_0 inst9922_2 inst9922_3 in
lemma compressReference_pos [Fintype ι] [DecidableEq ι] [DecidableEq κ] (D : Matrix ι ι ℂ) (hD : D.PosSemidef)
{Z : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ} (hZ : Z.PosSemidef) :
(compressReference D Z).PosSemidef :=
(hZ.submatrix Sum.inr).add (hD.smul (hZ.submatrix Sum.inl).trace_nonneg)
omit inst9922_2 inst9922_3 in
lemma compressReference_trace [DecidableEq ι] [DecidableEq κ] (D : Matrix ι ι ℂ) (hD : trace D = 1)
(Z : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ) : trace (compressReference D Z) = trace Z := by
change trace (Z.submatrix Sum.inr Sum.inr + trace (Z.submatrix Sum.inl Sum.inl) • D) = _
rw [Matrix.trace_add,Matrix.trace_smul,hD,smul_eq_mul,mul_one]
simp only [trace,diag,Matrix.submatrix_apply,Fintype.sum_sum_type]
exact add_comm _ _
omit inst9922_0 inst9922_2 inst9922_3 in
lemma compressReference_right [Fintype ι] [DecidableEq ι] [DecidableEq κ] (D Z : Matrix ι ι ℂ) :
compressReference (κ := κ) D (fromBlocks 0 0 0 Z) = Z := by
ext i j
simp [compressReference,Matrix.submatrix,Matrix.trace,Matrix.diag]
lemma padded_purification_unitary (M : Matrix ι κ ℂ) (S : Matrix ι ι ℂ)
(hS : S.IsHermitian) (hgram : M * Mᴴ = S * S) :
∃ U : Matrix.unitaryGroup (κ ⊕ ι) ℂ,
fromBlocks (0 : Matrix κ κ ℂ) Mᴴ 0 0 =
(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ) * fromBlocks 0 0 0 S := by
apply exists_unitary_mul_of_gram_eq
simp [Matrix.fromBlocks_conjTranspose,Matrix.fromBlocks_multiply,hS.eq,hgram]
def embedReference : Matrix κ κ ℂ →ₗ[ℂ] Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ where
toFun Z := fromBlocks Z 0 0 0
map_add' _ _ := by ext i j; cases i <;> cases j <;> simp
map_smul' _ _ := by ext i j; cases i <;> cases j <;> simp
omit inst9922_2 in
lemma embedReference_pos [DecidableEq ι] {Z : Matrix κ κ ℂ} (hZ : Z.PosSemidef) :
(embedReference (ι := ι) Z).PosSemidef := by
have hh := hZ.mul_mul_conjTranspose_same (Matrix.fromRows (1 : Matrix κ κ ℂ) (0 : Matrix ι κ ℂ))
rw [Matrix.conjTranspose_fromRows_eq_fromCols_conjTranspose,Matrix.fromRows_mul,
Matrix.fromRows_mul_fromCols] at hh
simpa [embedReference] using hh
omit inst9922_2 inst9922_3 in
lemma embedReference_trace [DecidableEq ι] [DecidableEq κ] (Z : Matrix κ κ ℂ) :
trace (embedReference (ι := ι) Z) = trace Z := by
simp [embedReference,trace,diag,Fintype.sum_sum_type]
def refSandwich (K : Matrix ι κ ℂ) : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ where
toFun Z := K * Z * Kᴴ
map_add' _ _ := by simp [Matrix.mul_add,Matrix.add_mul]
map_smul' _ _ := by simp [Matrix.mul_smul,Matrix.smul_mul]
lemma padded_purification_blocks (M : Matrix ι κ ℂ) (S : Matrix ι ι ℂ)
(hS : S.IsHermitian) (U : Matrix.unitaryGroup (κ ⊕ ι) ℂ)
(hU : fromBlocks (0 : Matrix κ κ ℂ) Mᴴ 0 0 =
(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ) * fromBlocks 0 0 0 S)
(X : Matrix ι ι ℂ) :
embedReference (ι := ι) (Mᴴ * X * M) =
(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ) * fromBlocks 0 0 0 (S * X * S) *
(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)ᴴ := by
let A : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ := fromBlocks 0 Mᴴ 0 0
let B : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ := fromBlocks 0 0 0 S
let Y : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ := fromBlocks 0 0 0 X
have he : embedReference (ι := ι) (Mᴴ * X * M) = A * Y * Aᴴ := by
simp [embedReference,A,Y,Matrix.fromBlocks_conjTranspose,Matrix.fromBlocks_multiply]
have hb : B * Y * Bᴴ = fromBlocks 0 0 0 (S*X*S) := by
simp [B,Y,Matrix.fromBlocks_conjTranspose,Matrix.fromBlocks_multiply,hS.eq]
change A = (U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)*B at hU
rw [he,hU,Matrix.conjTranspose_mul]
calc
(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)*B*Y*(Bᴴ*(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)ᴴ) =
(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)*(B*Y*Bᴴ)*(U : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ)ᴴ := by noncomm_ring
_ = _ := by rw [hb]
theorem purification_recovery (R : Matrix ι ι ℂ) (hR : Density R)
(M : Matrix ι κ ℂ) (hM : M * Mᴴ = R) :
∃ L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ,
(∀ Z, Z.PosSemidef → (L Z).PosSemidef) ∧
(∀ Z, trace (L Z) = trace Z) ∧
∀ X, L (Mᴴ * X * M) = CFC.sqrt R * X * CFC.sqrt R := by
let S := CFC.sqrt R
have hS : S.IsHermitian := (CFC.sqrt_nonneg R).posSemidef.isHermitian
have hgram : M*Mᴴ = S*S := by rw [hM]; exact (CFC.sqrt_mul_sqrt_self R hR.1.nonneg).symm
obtain ⟨U,hU⟩ := padded_purification_unitary M S hS hgram
let V : Matrix (κ ⊕ ι) (κ ⊕ ι) ℂ := U
let L := (compressReference (κ := κ) R).comp ((refSandwich Vᴴ).comp embedReference)
refine ⟨L,?_,?_,?_⟩
· intro Z hZ
exact compressReference_pos R hR.1 ((embedReference_pos hZ).mul_mul_conjTranspose_same Vᴴ)
· intro Z
change trace (compressReference R (Vᴴ * embedReference Z * Vᴴᴴ)) = _
rw [compressReference_trace R hR.2,Matrix.conjTranspose_conjTranspose,
Matrix.trace_mul_cycle,show V*Vᴴ = 1 from U.prop.2,one_mul,embedReference_trace]
· intro X
change compressReference R (Vᴴ * embedReference (Mᴴ*X*M) * Vᴴᴴ) = _
rw [padded_purification_blocks M S hS U hU X,Matrix.conjTranspose_conjTranspose]
have hv : Vᴴ * (V * fromBlocks 0 0 0 (S*X*S) * Vᴴ) * V =
fromBlocks 0 0 0 (S*X*S) := by
rw [mul_assoc V _ _,← mul_assoc Vᴴ V _,show Vᴴ*V=1 from U.prop.1,one_mul,
mul_assoc,show Vᴴ*V=1 from U.prop.1,mul_one]
change compressReference R (Vᴴ*(V*fromBlocks 0 0 0 (S*X*S)*Vᴴ)*V) = _
rw [hv,compressReference_right]
end
section
open Matrix
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator
universe v10053_0 v10053_1
theorem purification_recovery_transpose {ι : Type v10053_0} {κ : Type v10053_1}
[Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ]
(R : Matrix ι ι ℂ) (hR : Density R)
(M : Matrix ι κ ℂ) (hM : M * Mᴴ = R) :
∃ L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ,
(∀ Z, Z.PosSemidef → (L Z).PosSemidef) ∧
(∀ Z, trace (L Z) = trace Z) ∧
∀ X, L ((Mᴴ * X * M)ᵀ) = (CFC.sqrt R * X * CFC.sqrt R)ᵀ := by
obtain ⟨L,hpos,htr,hrec⟩ := purification_recovery R hR M hM
let J : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ :=
{ toFun Z := (L Zᵀ)ᵀ
map_add' Z W := by simp only [Matrix.transpose_add,map_add]
map_smul' c Z := by simp only [Matrix.transpose_smul,map_smul,RingHom.id_apply] }
refine ⟨J,?_,?_,?_⟩
· intro Z hZ
exact (hpos Zᵀ hZ.transpose).transpose
· intro Z
change trace (L Zᵀ)ᵀ = trace Z
rw [Matrix.trace_transpose,htr,Matrix.trace_transpose]
· intro X
change (L ((Mᴴ*X*M)ᵀ)ᵀ)ᵀ = _
rw [Matrix.transpose_transpose,hrec]
end
section
open Matrix
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
universe v10089_0 v10089_1
variable {ι : Type v10089_0} {κ : Type v10089_1} [inst10089_0 : Fintype ι] [inst10089_1 : Fintype κ] [inst10089_2 : DecidableEq ι] [inst10089_3 : DecidableEq κ]
def purificationFilter (P : Matrix ι κ ℂ) : Matrix κ ι ℂ :=
(Real.sqrt (Fintype.card ι : ℝ) : ℂ) • Pᵀ
open MeasureTheory
/-- Matrix-valued output entries after purification and publication of the transcript. -/
def publicPurifiedEntries {Ω T K : Type*} [MeasurableSpace Ω] [MeasurableSpace T]
(μ : Measure Ω) (record : Ω → T) (W : K → K → Ω → Matrix ι ι ℂ)
(P : Matrix ι κ ℂ) (a b : K) (x y : κ) : ComplexMeasure T :=
∑ i, ∑ j, (purificationFilter P x i * star (purificationFilter P y j)) •
(μ.withDensityᵥ (fun ω => W a b ω i j)).map record
/-- The positive representative of the entrywise Radon–Nikodym derivative. -/
def positiveEntryDensity {Ω : Type*} [MeasurableSpace Ω]
(W : ι → ι → ComplexMeasure Ω) (μ : Measure Ω) (t : Ω) : Matrix ι ι ℂ := by
classical
let D : Matrix ι ι ℂ := fun i j => (W i j).rnDeriv μ t
exact if D.PosSemidef then D else 0
omit inst10089_1 inst10089_2 inst10089_3 in
lemma purificationFilter_block [Fintype κ] [DecidableEq ι] [DecidableEq κ] (P : Matrix ι κ ℂ) (U : Matrix ι ι ℂ) :
purificationFilter P * U * (purificationFilter P)ᴴ =
(Pᴴ * ((Fintype.card ι : ℂ) • Uᵀ) * P)ᵀ := by
have hc : (Real.sqrt (Fintype.card ι : ℝ) : ℂ) *
(Real.sqrt (Fintype.card ι : ℝ) : ℂ) = (Fintype.card ι : ℂ) := by
rw [← Complex.ofReal_mul,Real.mul_self_sqrt (Nat.cast_nonneg _)]
norm_cast
simp only [purificationFilter,Matrix.conjTranspose_smul,Complex.star_def,
Complex.conj_ofReal,Matrix.smul_mul,Matrix.mul_smul,smul_smul,
Matrix.transpose_mul,Matrix.transpose_smul,Matrix.transpose_transpose,
Matrix.conjTranspose_transpose_eq_transpose_conjTranspose]
rw [hc,Matrix.mul_assoc]
lemma preparationFilter_eq_purificationFilter (R : Matrix ι ι ℂ) :
preparationFilter R = purificationFilter (CFC.sqrt R) := rfl
theorem purification_filter_recovery (R : Matrix ι ι ℂ) (hR : Density R)
(P : Matrix ι κ ℂ) (hP : P * Pᴴ = R) :
∃ L : Matrix κ κ ℂ →ₗ[ℂ] Matrix ι ι ℂ,
(∀ Z, Z.PosSemidef → (L Z).PosSemidef) ∧
(∀ Z, trace (L Z) = trace Z) ∧
∀ U, L (purificationFilter P * U * (purificationFilter P)ᴴ) =
preparationFilter R * U * (preparationFilter R)ᴴ := by
obtain ⟨L,hpos,htr,he⟩ := purification_recovery_transpose R hR P hP
refine ⟨L,hpos,htr,?_⟩
intro U
rw [purificationFilter_block,he,preparationFilter_eq_purificationFilter,
purificationFilter_block,(CFC.sqrt_nonneg R).posSemidef.isHermitian.eq]
end
open Matrix MeasureTheory ProbabilityTheory Function Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
open UnrestrictedQuantum
universe v10227_0 v10227_1 v10227_2 v10227_3 v10227_4 v10227_5 v10227_6 v10227_7 v10227_8 v10227_9 v10227_10
variable {O : Type v10227_0} {M : Type v10227_1} {ι : Type v10227_2} {η : Type v10227_3} [inst10227_0 : MeasurableSpace O] [inst10227_1 : MeasurableSpace M]
[inst10227_2 : StandardBorelSpace O] [inst10227_3 : Nonempty O] [inst10227_4 : StandardBorelSpace M] [inst10227_5 : Nonempty M]
[inst10227_6 : Fintype ι] [inst10227_7 : Fintype η] [inst10227_8 : DecidableEq ι] [inst10227_9 : DecidableEq η]
[inst10227_10 : Nonempty ι] [inst10227_11 : Nonempty η]
{d : Discussion O M} {A : ℕ → Type v10227_4} {B : ℕ → Type v10227_5}
[inst10227_12 : ∀ n, AddCommGroup (A n)] [inst10227_13 : ∀ n, Module ℂ (A n)] [inst10227_14 : ∀ n, One (A n)] [inst10227_15 : ∀ n, LE (A n)]
[inst10227_16 : ∀ n, AddCommGroup (B n)] [inst10227_17 : ∀ n, Module ℂ (B n)] [inst10227_18 : ∀ n, One (B n)] [inst10227_19 : ∀ n, LE (B n)]
{TA : Type v10227_6} {TB : Type v10227_7} {CA : Type v10227_8} {CB : Type v10227_9}
[inst10227_20 : AddCommGroup TA] [inst10227_21 : Module ℂ TA] [inst10227_22 : One TA] [inst10227_23 : LE TA]
[inst10227_24 : AddCommGroup TB] [inst10227_25 : Module ℂ TB] [inst10227_26 : One TB] [inst10227_27 : LE TB]
[inst10227_28 : AddCommGroup CA] [inst10227_29 : Module ℂ CA] [inst10227_30 : One CA] [inst10227_31 : LE CA]
[inst10227_32 : AddCommGroup CB] [inst10227_33 : Module ℂ CB] [inst10227_34 : One CB] [inst10227_35 : LE CB]
{κ : Type v10227_10} [inst10227_36 : Fintype κ] [inst10227_37 : DecidableEq κ]
namespace BitProtocol
variable (p : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB)
(R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R)
(P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R)
def purifiedOutput (i j : Bool) : PositiveMatrixMeasure (ℕ → M) κ :=
(p.probeOutput i j).filter (purificationFilter P)
omit inst10227_10 inst10227_11 inst10227_37 in
lemma purifiedOutput_ac [Nonempty ι] [Nonempty η] [DecidableEq κ] (i j : Bool) (S : Set (ℕ → M)) (hS : MeasurableSet S)
(hnull : d.transcriptLaw S = 0) : (p.purifiedOutput P i j).value S = 0 := by
obtain ⟨X,Y,hXm,hYm,hX,hY,he,hn⟩ := p.public_factors
rw [purifiedOutput,PositiveMatrixMeasure.filter_value,he i j S hS,
Measure.restrict_eq_zero.mpr hnull,integral_zero_measure,Matrix.mul_zero,Matrix.zero_mul]
include hR hP
omit inst10227_10 inst10227_11 in
lemma purifiedOutput_recovery [Nonempty ι] [Nonempty η] :
∃ L : Matrix κ κ ℂ →ₗ[ℂ] Matrix (ι × η) (ι × η) ℂ,
(∀ Z, Z.PosSemidef → (L Z).PosSemidef) ∧
(∀ Z, trace (L Z) = trace Z) ∧
∀ i j S, L ((p.purifiedOutput P i j).value S) = (p.canonicalOutput R i j).value S := by
obtain ⟨L,hpos,htr,he⟩ := purification_filter_recovery R hR P hP
refine ⟨L,hpos,htr,?_⟩
intro i j S
simpa only [purifiedOutput,canonicalOutput,PositiveMatrixMeasure.filter_value] using
he ((p.probeOutput i j).value S)
lemma purifiedOutput_normalized :
(trace ((p.purifiedOutput P false false).value Set.univ)).re +
(trace ((p.purifiedOutput P false true).value Set.univ)).re +
(trace ((p.purifiedOutput P true false).value Set.univ)).re +
(trace ((p.purifiedOutput P true true).value Set.univ)).re = 1 := by
obtain ⟨L,hpos,htr,he⟩ := p.purifiedOutput_recovery R hR P hP
have hh i j : trace ((p.purifiedOutput P i j).value Set.univ) =
trace ((p.canonicalOutput R i j).value Set.univ) := by rw [← he,htr]
simp_rw [hh]
exact p.canonicalOutput_normalized R hR
def purifiedDensity (ν : Measure (ℕ → M)) [SigmaFinite ν]
(hμν : d.transcriptLaw ≪ ν) : BitDensity ν κ :=
PositiveMatrixMeasure.toBitDensity (p.purifiedOutput P) ν
(fun i j S hS hz => p.purifiedOutput_ac P i j S hS (hμν hz))
(p.purifiedOutput_normalized R hR P hP)
/-- The operational bit error written directly in terms of the output entries. -/
def rawPurifiedSecretBitError (P : Matrix (ι × η) κ ℂ)
(sigma : PositiveMatrixMeasure (ℕ → M) κ) : ℝ :=
let ν := d.transcriptLaw + sigma.traceMeasure
let τ := fun i j => positiveEntryDensity
(publicPurifiedEntries d.probeLaw d.sampler.publicRecord p.completeReference P i j) ν
let σ := sigma.positiveDensity ν
(∫ t, (trace (τ false true t)).re ∂ν) +
(∫ t, (trace (τ true false t)).re ∂ν) +
(∫ t, traceNorm (τ false false t - (1 / ((2 : ℕ) : ℝ)) • σ t) ∂ν) +
(∫ t, traceNorm (τ true true t - (1 / ((2 : ℕ) : ℝ)) • σ t) ∂ν)
def purifiedSecretBitError (sigma : PositiveMatrixMeasure (ℕ → M) κ) : ℝ :=
(p.purifiedDensity R hR P hP (d.transcriptLaw + sigma.traceMeasure)
(Measure.AbsolutelyContinuous.rfl.add_right _)).idealBitError
(sigma.positiveDensity (d.transcriptLaw + sigma.traceMeasure))
lemma rawPurifiedSecretBitError_eq (sigma : PositiveMatrixMeasure (ℕ → M) κ) :
p.rawPurifiedSecretBitError P sigma = p.purifiedSecretBitError R hR P hP sigma := rfl
end BitProtocol
end ZeroKey
namespace UnrestrictedQuantum
open Matrix MeasureTheory Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator
section
universe v10363_0 v10363_1 v10363_2 v10363_3
variable {A : Type v10363_0} {B : Type v10363_1} {O : Type v10363_2} {ι : Type v10363_3} [inst10363_0 : AddCommGroup A] [inst10363_1 : Module ℂ A] [inst10363_2 : One A] [inst10363_3 : LE A]
[inst10363_4 : AddCommGroup B] [inst10363_5 : Module ℂ B] [inst10363_6 : One B] [inst10363_7 : LE B]
[inst10363_8 : MeasurableSpace O] [inst10363_9 : Nonempty O] [inst10363_10 : Fintype ι] [inst10363_11 : DecidableEq ι]
namespace ObservableInstrument
def postprocess (J : ObservableInstrument O A B) (f : O → Bool) (hf : Measurable f) :
ObservableInstrument Bool A B where
operation E := J.operation (f ⁻¹' E)
positive E hE x hx := J.positive _ (hf hE) x hx
total_unit := by simpa only [Set.preimage_univ] using J.total_unit
end ObservableInstrument
namespace InstrumentRun
variable {J : ObservableInstrument O A B} {S : ReferenceFunctional A ι}
(r : InstrumentRun J S)
omit inst10363_9 inst10363_11 in
lemma event_trace [Nonempty O] [DecidableEq ι] (E : Set O) (hE : MeasurableSet E) :
trace (S (J.operation E 1)) = (r.law.real E : ℂ) := by
calc
_ = ∫ o in E, trace (r.posterior o 1) ∂r.law := by
simp only [trace,diag]
rw [integral_finsetSum _ (fun i _ => (r.integrable 1 i i).integrableOn)]
apply Finset.sum_congr rfl
intro i _
exact (r.update E hE 1 i i).symm
_ = _ := by simp [r.posterior_trace,integral_const,Complex.real_smul,Measure.real]
omit inst10363_9 inst10363_11 in
lemma event_zero [Nonempty O] [DecidableEq ι] (E : Set O) (hE : MeasurableSet E) (hz : r.law E = 0) (x : B) :
S (J.operation E x) = 0 := by
ext i j
rw [← r.update E hE x i j,Measure.restrict_eq_zero.mpr hz,integral_zero_measure]
rfl
variable (f : O → Bool) (hf : Measurable f)
def coarseMass (i : Bool) : ℝ := r.law.real (f ⁻¹' {i})
def coarsePosterior (i : Bool) : ReferenceFunctional B ι :=
if r.coarseMass f i = 0 then r.posterior (Classical.choice ‹Nonempty O›)
else ((r.coarseMass f i)⁻¹ : ℝ) • (S.comp (J.operation (f ⁻¹' {i})))
include hf
omit inst10363_11 in
lemma coarsePosterior_positive [DecidableEq ι] (hS : PositiveFunctional S) (i : Bool) :
PositiveFunctional (r.coarsePosterior f i) := by
unfold coarsePosterior
split
· exact r.posterior_positive _
· intro x hx
exact (hS _ (J.positive _ (hf (measurableSet_singleton i)) x hx)).smul
(inv_nonneg.mpr (ENNReal.toReal_nonneg))
lemma coarsePosterior_trace (_hS : PositiveFunctional S) (i : Bool) :
trace (r.coarsePosterior f i 1) = 1 := by
unfold coarsePosterior
split
· exact r.posterior_trace _
· rename_i hn
simp only [LinearMap.smul_apply,LinearMap.comp_apply,Matrix.trace_smul]
rw [r.event_trace _ (hf (measurableSet_singleton i))]
change ((r.coarseMass f i)⁻¹ : ℝ) • ((r.coarseMass f i : ℝ) : ℂ) = 1
simp only [Complex.real_smul,Complex.ofReal_inv,inv_mul_cancel₀ (Complex.ofReal_ne_zero.mpr hn)]
lemma coarsePosterior_weighted (i : Bool) (x : B) :
r.coarseMass f i • r.coarsePosterior f i x = S (J.operation (f ⁻¹' {i}) x) := by
let : IsProbabilityMeasure r.law := r.probability
unfold coarsePosterior
split
· rename_i hz
rw [hz,zero_smul]
symm
apply r.event_zero _ (hf (measurableSet_singleton i))
exact (ENNReal.toReal_eq_zero_iff _).mp hz |>.resolve_right (measure_ne_top _ _)
· rename_i hn
simp only [LinearMap.smul_apply,LinearMap.comp_apply,smul_smul,mul_inv_cancel₀ hn,one_smul]
lemma coarsePosterior_singleton (i : Bool) (x : B) (k l : ι) :
(∫ b in {i}, r.coarsePosterior f b x k l ∂(r.law.map f)) =
S (J.operation (f ⁻¹' {i}) x) k l := by
rw [integral_singleton]
have hm : (r.law.map f).real {i} = r.coarseMass f i := by
rw [Measure.real,Measure.map_apply hf (measurableSet_singleton i)]
rfl
rw [hm]
exact congrArg (fun U : Matrix ι ι ℂ => U k l) (r.coarsePosterior_weighted f hf i x)
lemma coarsePosterior_integral (E : Set Bool) (x : B) (k l : ι) :
(∫ b in E, r.coarsePosterior f b x k l ∂(r.law.map f)) =
S (J.operation (f ⁻¹' E) x) k l := by
let : IsProbabilityMeasure r.law := r.probability
let : IsProbabilityMeasure (r.law.map f) := inferInstance
have hpart : E = ∅ ∨ E = {false} ∨ E = {true} ∨ E = Set.univ := by
by_cases h0 : false ∈ E <;> by_cases h1 : true ∈ E
· right; right; right; ext b; cases b <;> simp_all
· right; left; ext b; cases b <;> simp_all
· right; right; left; ext b; cases b <;> simp_all
· left; ext b; cases b <;> simp_all
rcases hpart with rfl | rfl | rfl | rfl
· simp only [setIntegral_empty,Set.preimage_empty]
exact (congrArg (fun U : Matrix ι ι ℂ => U k l)
(r.event_zero ∅ MeasurableSet.empty (measure_empty) x)).symm
· exact r.coarsePosterior_singleton f hf false x k l
· exact r.coarsePosterior_singleton f hf true x k l
· have hd : Disjoint (f ⁻¹' {false}) (f ⁻¹' {true}) := by
apply Set.disjoint_left.mpr
intro o h0 h1
simp only [Set.mem_preimage,Set.mem_singleton_iff] at h0 h1
rw [h0] at h1
contradiction
have hu : (f ⁻¹' {false}) ∪ (f ⁻¹' {true}) = Set.univ := by
ext o; cases f o <;> simp
have hb : ({false} : Set Bool) ∪ {true} = Set.univ := by ext b; cases b <;> simp
rw [← hb,setIntegral_union (by simp) (measurableSet_singleton true)
Integrable.of_finite.integrableOn Integrable.of_finite.integrableOn,
r.coarsePosterior_singleton f hf false x k l,
r.coarsePosterior_singleton f hf true x k l]
rw [← r.update _ (hf (measurableSet_singleton false)) x k l,
← r.update _ (hf (measurableSet_singleton true)) x k l]
rw [← setIntegral_union hd (hf (measurableSet_singleton true))
(r.integrable x k l).integrableOn (r.integrable x k l).integrableOn,hu]
simpa only [Set.preimage_union,Set.preimage_univ,hu] using
r.update Set.univ MeasurableSet.univ x k l
def postprocess (hS : PositiveFunctional S) :
InstrumentRun (J.postprocess f hf) S where
law := r.law.map f
probability := by
let : IsProbabilityMeasure r.law := r.probability
exact inferInstance
posterior := r.coarsePosterior f
posterior_positive := r.coarsePosterior_positive f hf hS
posterior_trace := r.coarsePosterior_trace f hf hS
integrable x k l := by
let : IsProbabilityMeasure r.law := r.probability
let : IsProbabilityMeasure (r.law.map f) := inferInstance
exact Integrable.of_finite
update E hE x k l := r.coarsePosterior_integral f hf E x k l
end InstrumentRun
end
universe v10518_0 v10518_1 v10518_2 v10518_3 v10518_4
variable {A : Type v10518_0} {B : Type v10518_1} {K : Type v10518_2} {ι : Type v10518_3} {Ω : Type v10518_4} [inst10518_0 : AddCommGroup A] [inst10518_1 : Module ℂ A] [inst10518_2 : One A] [inst10518_3 : LE A]
[inst10518_4 : AddCommGroup B] [inst10518_5 : Module ℂ B] [inst10518_6 : One B] [inst10518_7 : LE B]
[inst10518_8 : MeasurableSpace K] [inst10518_9 : MeasurableSingletonClass K] [inst10518_10 : Fintype K] [inst10518_11 : DecidableEq K] [inst10518_12 : Nonempty K]
[inst10518_13 : Fintype ι] [inst10518_14 : DecidableEq ι]
omit inst10518_10 inst10518_11 inst10518_12 inst10518_14 in
lemma InstrumentRun.event_finset [Fintype K] [DecidableEq K] [Nonempty K] [DecidableEq ι] {J : ObservableInstrument K A B}
{S : ReferenceFunctional A ι} (r : InstrumentRun J S) (s : Finset K) (x : B) :
S (J.operation s x) = ∑ k ∈ s, S (J.operation {k} x) := by
ext i j
simp only [Matrix.sum_apply]
rw [← r.update s (s.finite_toSet.measurableSet) x i j,
setIntegral_finset s (r.integrable x i j).integrableOn]
apply Finset.sum_congr rfl
intro k hk
rw [← r.update {k} (measurableSet_singleton k) x i j,integral_singleton]
lemma InstrumentRun.event_total {J : ObservableInstrument K A B}
{S : ReferenceFunctional A ι} (r : InstrumentRun J S) :
(∑ k, S (J.operation {k} 1)) = S 1 := by
simpa only [Finset.coe_univ,J.total_unit] using (r.event_finset Finset.univ 1).symm
variable {L : MeasurableSpace Ω} {mΩ : MeasurableSpace Ω}
{μ : Measure Ω} {F : Filtration ℕ mΩ} {U : ℕ → Ω → Matrix ι ι ℂ}
(e : IncomingObservableProcess (L := L) (A := A) μ F U)
namespace IncomingObservableProcess
structure FiniteReadout where
instrument : Ω → ObservableInstrument K A B
run : ∀ x, InstrumentRun (instrument x) (e.state x)
positive_unit : (0 : B) ≤ 1
local_measurable : ∀ k, Measurable[L] (fun x => e.state x ((instrument x).operation {k} 1))
namespace FiniteReadout
variable {e} (b : e.FiniteReadout (B := B) (K := K))
def value (k : K) (x : Ω) : Matrix ι ι ℂ := e.state x ((b.instrument x).operation {k} 1)
omit inst10518_9 inst10518_10 inst10518_11 inst10518_12 in
lemma measurable [MeasurableSingletonClass K] [Fintype K] [DecidableEq K] [Nonempty K] (k : K) : Measurable[L] (b.value k) := b.local_measurable k
omit inst10518_10 inst10518_11 inst10518_12 in
lemma positive [Fintype K] [DecidableEq K] [Nonempty K] (k : K) (x : Ω) : (b.value k x).PosSemidef :=
e.positive x _ ((b.instrument x).positive {k} (measurableSet_singleton k) 1 b.positive_unit)
lemma sum (x : Ω) : (∑ k, b.value k x) = e.state x 1 := (b.run x).event_total
lemma subdensity (k : K) (x : Ω) : ZeroKey.Subdensity (b.value k x) := by
refine ⟨b.positive k x,?_⟩
have hsum := congrArg (fun M : Matrix ι ι ℂ => (trace M).re) (b.sum x)
simp only [Matrix.trace_sum,Complex.re_sum,e.normalized x,Complex.one_re] at hsum
rw [← hsum]
exact Finset.single_le_sum (fun l _ => (RCLike.nonneg_iff.mp (b.positive l x).trace_nonneg).1)
(Finset.mem_univ k)
lemma event_finset (s : Finset K) (x : Ω) :
e.state x ((b.instrument x).operation s 1) = ∑ k ∈ s, b.value k x :=
(b.run x).event_finset s 1
lemma eventMeasurable (s : Finset K) :
Measurable[L] (fun x => e.state x ((b.instrument x).operation s 1)) := by
simp_rw [b.event_finset s]
exact Finset.measurable_sum s (fun k _ => b.local_measurable k)
def postprocess (f : K → Bool) : e.BitReadout (B := B) where
instrument x := (b.instrument x).postprocess f (measurable_of_finite f)
run x := (b.run x).postprocess f (measurable_of_finite f) (e.positive x)
positive_unit := b.positive_unit
local_measurable i := by
let s := Finset.univ.filter (fun k => f k = i)
have hs : (s : Set K) = f ⁻¹' {i} := by ext k; simp [s]
change Measurable[L] (fun x => e.state x ((b.instrument x).operation (f ⁻¹' {i}) 1))
rw [← hs]
exact b.eventMeasurable s
end FiniteReadout
end IncomingObservableProcess
end UnrestrictedQuantum
namespace ZeroKey
section
open Matrix MeasureTheory ProbabilityTheory Function unitInterval Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
section
open UnrestrictedQuantum
universe v10619_0 v10619_1 v10619_2 v10619_3 v10619_4 v10619_5 v10619_6 v10619_7 v10619_8 v10619_9 v10619_10
variable {O : Type v10619_0} {M : Type v10619_1} {ι : Type v10619_2} {η : Type v10619_3} [inst10619_0 : MeasurableSpace O] [inst10619_1 : MeasurableSpace M]
[inst10619_2 : StandardBorelSpace O] [inst10619_3 : Nonempty O] [inst10619_4 : StandardBorelSpace M] [inst10619_5 : Nonempty M]
[inst10619_6 : Fintype ι] [inst10619_7 : Fintype η] [inst10619_8 : DecidableEq ι] [inst10619_9 : DecidableEq η]
{K : Type v10619_4} [inst10619_10 : MeasurableSpace K] [inst10619_11 : MeasurableSingletonClass K]
[inst10619_12 : Fintype K] [inst10619_13 : DecidableEq K] [inst10619_14 : Nonempty K]
(d : Discussion O M)
(A : ℕ → Type v10619_5) (B : ℕ → Type v10619_6)
[inst10619_15 : ∀ n, AddCommGroup (A n)] [inst10619_16 : ∀ n, Module ℂ (A n)] [inst10619_17 : ∀ n, One (A n)] [inst10619_18 : ∀ n, LE (A n)]
[inst10619_19 : ∀ n, AddCommGroup (B n)] [inst10619_20 : ∀ n, Module ℂ (B n)] [inst10619_21 : ∀ n, One (B n)] [inst10619_22 : ∀ n, LE (B n)]
(TA : Type v10619_7) (TB : Type v10619_8) (CA : Type v10619_9) (CB : Type v10619_10)
[inst10619_23 : AddCommGroup TA] [inst10619_24 : Module ℂ TA] [inst10619_25 : One TA] [inst10619_26 : LE TA]
[inst10619_27 : AddCommGroup TB] [inst10619_28 : Module ℂ TB] [inst10619_29 : One TB] [inst10619_30 : LE TB]
[inst10619_31 : AddCommGroup CA] [inst10619_32 : Module ℂ CA] [inst10619_33 : One CA] [inst10619_34 : LE CA]
[inst10619_35 : AddCommGroup CB] [inst10619_36 : Module ℂ CB] [inst10619_37 : One CB] [inst10619_38 : LE CB]
structure FiniteProtocol where
executionA : LocalObservableExecution (ι := ι) A d.kernelA d.sendA
executionB : LocalObservableExecution (ι := η) B d.kernelB d.sendB
initialA : executionA.reference 0 (Fin.elim0,Fin.elim0) =
keepReference (outer (localProbe (ι := ι)) localProbe)
initialB : executionB.reference 0 (Fin.elim0,Fin.elim0) =
keepReference (outer (localProbe (ι := η)) localProbe)
incomingA : IncomingObservableProcess (L := d.sampler.localField true) (A := TA)
d.probeLaw historyFiltration
(fun n x => AdaptiveQuantum.globalLocalReferenceA d.sampler d.kernelA executionA n (historyPrefix n x))
incomingB : IncomingObservableProcess (L := d.sampler.localField false) (A := TB)
d.probeLaw historyFiltration
(fun n x => AdaptiveQuantum.globalLocalReferenceB d.sampler d.kernelB executionB n (historyPrefix n x))
readoutA : incomingA.FiniteReadout (B := CA) (K := K)
readoutB : incomingB.FiniteReadout (B := CB) (K := K)
variable {d A B TA TB CA CB}
namespace FiniteProtocol
variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB)
def toBit (f : K → Bool) : BitProtocol (ι := ι) (η := η) d A B TA TB CA CB where
executionA := p.executionA
executionB := p.executionB
initialA := p.initialA
initialB := p.initialB
incomingA := p.incomingA
incomingB := p.incomingB
readoutA := p.readoutA.postprocess f
readoutB := p.readoutB.postprocess f
def completeReference (i j : K) (x : ℕ → O) : Matrix (ι × η) (ι × η) ℂ :=
p.readoutA.value i x ⊗ₖ p.readoutB.value j x
omit inst10619_4 inst10619_5 in
lemma completeReference_positive [StandardBorelSpace M] [Nonempty M] (i j : K) (x : ℕ → O) :
(p.completeReference i j x).PosSemidef :=
(p.readoutA.positive i x).kronecker (p.readoutB.positive j x)
omit inst10619_4 inst10619_5 in
lemma completeReference_measurable [StandardBorelSpace M] [Nonempty M] (i j : K) : Measurable (p.completeReference i j) :=
measurable_matrix_kronecker
((p.readoutA.measurable i).mono (d.sampler.localField_le true) le_rfl)
((p.readoutB.measurable j).mono (d.sampler.localField_le false) le_rfl)
lemma completeReference_integrable (i j : K) : Integrable (p.completeReference i j) d.probeLaw :=
integrable_subdensity _
(fun x => subdensity_kronecker (p.readoutA.subdensity i x) (p.readoutB.subdensity j x))
(p.completeReference_measurable i j) d.probeLaw
lemma completeReference_entry_integrable (i j : K) (k l : ι × η) :
Integrable (fun x => p.completeReference i j x k l) d.probeLaw :=
((Matrix.entryLinearMap ℂ ℂ k l).toContinuousLinearMap).integrable_comp
(p.completeReference_integrable i j)
def probeOutput (i j : K) : PositiveMatrixMeasure (ℕ → M) (ι × η) :=
(positiveMatrixMeasureOfDensity (p.completeReference_entry_integrable i j)
(Eventually.of_forall (p.completeReference_positive i j))).pushforward
d.sampler.publicRecord d.sampler.measurable_publicRecord
lemma probeOutput_event (i j : K) (S : Set (ℕ → M)) (hS : MeasurableSet S) :
(p.probeOutput i j).value S =
∫ x in d.sampler.publicRecord ⁻¹' S, p.completeReference i j x ∂d.probeLaw := by
rw [probeOutput,PositiveMatrixMeasure.pushforward_value _ _ _ S hS,
positiveMatrixMeasureOfDensity_value _ _ _ (d.sampler.measurable_publicRecord hS)]
def canonicalOutput (R : Matrix (ι × η) (ι × η) ℂ) (i j : K) :
PositiveMatrixMeasure (ℕ → M) (ι × η) :=
(p.probeOutput i j).filter (preparationFilter R)
lemma canonicalOutput_event (R : Matrix (ι × η) (ι × η) ℂ)
(i j : K) (S : Set (ℕ → M)) (hS : MeasurableSet S) :
(p.canonicalOutput R i j).value S =
∫ x in d.sampler.publicRecord ⁻¹' S,
preparationFilter R * p.completeReference i j x * (preparationFilter R)ᴴ ∂d.probeLaw := by
rw [canonicalOutput,PositiveMatrixMeasure.filter_value,p.probeOutput_event i j S hS,
integral_filter _ (p.completeReference_integrable i j).integrableOn]
end FiniteProtocol
end
open UnrestrictedQuantum
universe v10926_0 v10926_1 v10926_2 v10926_3 v10926_4 v10926_5 v10926_6 v10926_7 v10926_8 v10926_9 v10926_10
variable {O : Type v10926_0} {M : Type v10926_1} {ι : Type v10926_2} {η : Type v10926_3} [inst10926_0 : MeasurableSpace O] [inst10926_1 : MeasurableSpace M]
[inst10926_2 : StandardBorelSpace O] [inst10926_3 : Nonempty O] [inst10926_4 : StandardBorelSpace M] [inst10926_5 : Nonempty M]
[inst10926_6 : Fintype ι] [inst10926_7 : Fintype η] [inst10926_8 : DecidableEq ι] [inst10926_9 : DecidableEq η]
{K : Type v10926_4} [inst10926_10 : MeasurableSpace K] [inst10926_11 : MeasurableSingletonClass K]
[inst10926_12 : Fintype K] [inst10926_13 : DecidableEq K] [inst10926_14 : Nonempty K]
[inst10926_15 : Nonempty ι] [inst10926_16 : Nonempty η]
(d : Discussion O M)
(A : ℕ → Type v10926_5) (B : ℕ → Type v10926_6)
[inst10926_17 : ∀ n, AddCommGroup (A n)] [inst10926_18 : ∀ n, Module ℂ (A n)] [inst10926_19 : ∀ n, One (A n)] [inst10926_20 : ∀ n, LE (A n)]
[inst10926_21 : ∀ n, AddCommGroup (B n)] [inst10926_22 : ∀ n, Module ℂ (B n)] [inst10926_23 : ∀ n, One (B n)] [inst10926_24 : ∀ n, LE (B n)]
(TA : Type v10926_7) (TB : Type v10926_8) (CA : Type v10926_9) (CB : Type v10926_10)
[inst10926_25 : AddCommGroup TA] [inst10926_26 : Module ℂ TA] [inst10926_27 : One TA] [inst10926_28 : LE TA]
[inst10926_29 : AddCommGroup TB] [inst10926_30 : Module ℂ TB] [inst10926_31 : One TB] [inst10926_32 : LE TB]
[inst10926_33 : AddCommGroup CA] [inst10926_34 : Module ℂ CA] [inst10926_35 : One CA] [inst10926_36 : LE CA]
[inst10926_37 : AddCommGroup CB] [inst10926_38 : Module ℂ CB] [inst10926_39 : One CB] [inst10926_40 : LE CB]
variable {d A B TA TB CA CB}
namespace FiniteProtocol
variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB)
omit inst10926_4 inst10926_5 inst10926_15 inst10926_16 in
lemma completeReference_sum [StandardBorelSpace M] [Nonempty M] [Nonempty ι] [Nonempty η] (x : ℕ → O) :
(∑ i, ∑ j, p.completeReference i j x) =
p.incomingA.state x 1 ⊗ₖ p.incomingB.state x 1 := by
rw [← p.readoutA.sum x,← p.readoutB.sum x]
ext a b
simp only [completeReference,Matrix.sum_apply,Matrix.kroneckerMap_apply,
Finset.sum_mul,Finset.mul_sum]
rw [Finset.sum_comm]
lemma completeReference_total :
(∑ i, ∑ j, ∫ x, p.completeReference i j x ∂d.probeLaw) =
keepReference (outer (localProbe (ι := ι × η)) localProbe) := by
simp_rw [← integral_finsetSum _ (fun j _ => p.completeReference_integrable _ j)]
rw [← integral_finsetSum _ (fun i _ => integrable_finsetSum _
(fun j _ => p.completeReference_integrable i j))]
simp_rw [p.completeReference_sum]
have hc := AdaptiveQuantum.incoming_joint_reference_consistency
d.sampler d.kernelA d.kernelB p.executionA p.executionB d.probeLaw d.probeLaw_prefix
p.incomingA p.incomingB 0 Set.univ MeasurableSet.univ
simp only [Measure.restrict_univ] at hc
rw [hc]
have hpre (x : ℕ → O) : historyPrefix 0 x = Fin.elim0 := Subsingleton.elim _ _
simp_rw [hpre]
have hi := (p.toBit (fun _ => false)).initial_joint_reference
change AdaptiveQuantum.jointReference d.sampler d.kernelA d.kernelB p.executionA p.executionB
0 Fin.elim0 = _ at hi
simp [hi]
lemma canonicalOutput_sum (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) :
(∑ i, ∑ j, (p.canonicalOutput R i j).value Set.univ) = Rᵀ := by
simp_rw [p.canonicalOutput_event R _ _ Set.univ MeasurableSet.univ,
Set.preimage_univ,Measure.restrict_univ]
simp_rw [integral_filter _ (p.completeReference_integrable _ _)]
simp only [← Matrix.sum_mul,← Matrix.mul_sum]
rw [p.completeReference_total,← keepReference_filter,preparation_filter_identity,
canonical_reference R hR.1]
lemma canonicalOutput_normalized (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R) :
(∑ i, ∑ j, (trace ((p.canonicalOutput R i j).value Set.univ)).re) = 1 := by
have h := congrArg (fun X : Matrix (ι × η) (ι × η) ℂ => (trace X).re)
(p.canonicalOutput_sum R hR)
simpa only [Matrix.trace_sum,Complex.re_sum,Matrix.trace_transpose,hR.2,Complex.one_re] using h
end FiniteProtocol
end
section
open Matrix MeasureTheory ProbabilityTheory Function Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator Kronecker
open UnrestrictedQuantum
universe v11008_0 v11008_1 v11008_2 v11008_3 v11008_4 v11008_5 v11008_6 v11008_7 v11008_8 v11008_9 v11008_10 v11008_11
variable {O : Type v11008_0} {M : Type v11008_1} {ι : Type v11008_2} {η : Type v11008_3} [inst11008_0 : MeasurableSpace O] [inst11008_1 : MeasurableSpace M]
[inst11008_2 : StandardBorelSpace O] [inst11008_3 : Nonempty O] [inst11008_4 : StandardBorelSpace M] [inst11008_5 : Nonempty M]
[inst11008_6 : Fintype ι] [inst11008_7 : Fintype η] [inst11008_8 : DecidableEq ι] [inst11008_9 : DecidableEq η] [inst11008_10 : Nonempty ι] [inst11008_11 : Nonempty η]
{K : Type v11008_4} [inst11008_12 : MeasurableSpace K] [inst11008_13 : MeasurableSingletonClass K]
[inst11008_14 : Fintype K] [inst11008_15 : DecidableEq K] [inst11008_16 : Nonempty K]
{d : Discussion O M} {A : ℕ → Type v11008_5} {B : ℕ → Type v11008_6}
[inst11008_17 : ∀ n, AddCommGroup (A n)] [inst11008_18 : ∀ n, Module ℂ (A n)] [inst11008_19 : ∀ n, One (A n)] [inst11008_20 : ∀ n, LE (A n)]
[inst11008_21 : ∀ n, AddCommGroup (B n)] [inst11008_22 : ∀ n, Module ℂ (B n)] [inst11008_23 : ∀ n, One (B n)] [inst11008_24 : ∀ n, LE (B n)]
{TA : Type v11008_7} {TB : Type v11008_8} {CA : Type v11008_9} {CB : Type v11008_10}
[inst11008_25 : AddCommGroup TA] [inst11008_26 : Module ℂ TA] [inst11008_27 : One TA] [inst11008_28 : LE TA]
[inst11008_29 : AddCommGroup TB] [inst11008_30 : Module ℂ TB] [inst11008_31 : One TB] [inst11008_32 : LE TB]
[inst11008_33 : AddCommGroup CA] [inst11008_34 : Module ℂ CA] [inst11008_35 : One CA] [inst11008_36 : LE CA]
[inst11008_37 : AddCommGroup CB] [inst11008_38 : Module ℂ CB] [inst11008_39 : One CB] [inst11008_40 : LE CB]
{κ : Type v11008_11} [inst11008_41 : Fintype κ] [inst11008_42 : DecidableEq κ]
namespace FiniteProtocol
variable (p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB)
def purifiedOutput (P : Matrix (ι × η) κ ℂ) (i j : K) : PositiveMatrixMeasure (ℕ → M) κ :=
(p.probeOutput i j).filter (purificationFilter P)
omit inst11008_10 inst11008_11 in
lemma purifiedOutput_event [Nonempty ι] [Nonempty η] (P : Matrix (ι × η) κ ℂ)
(i j : K) (S : Set (ℕ → M)) (hS : MeasurableSet S) :
(p.purifiedOutput P i j).value S =
∫ x in d.sampler.publicRecord ⁻¹' S,
purificationFilter P * p.completeReference i j x * (purificationFilter P)ᴴ ∂d.probeLaw := by
rw [purifiedOutput,PositiveMatrixMeasure.filter_value,p.probeOutput_event i j S hS,
integral_filter _ (p.completeReference_integrable i j).integrableOn]
lemma purifiedOutput_ac (P : Matrix (ι × η) κ ℂ) (i j : K)
(S : Set (ℕ → M)) (hS : MeasurableSet S) (hz : d.transcriptLaw S = 0) :
(p.purifiedOutput P i j).value S = 0 := by
have hp : d.probeLaw (d.sampler.publicRecord ⁻¹' S) = 0 := by
simpa only [Discussion.transcriptLaw,Measure.map_apply d.sampler.measurable_publicRecord hS] using hz
rw [p.purifiedOutput_event P i j S hS,Measure.restrict_eq_zero.mpr hp,integral_zero_measure]
lemma purifiedOutput_normalized (R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R)
(P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R) :
(trace (∑ i, ∑ j, (p.purifiedOutput P i j).value Set.univ)).re = 1 := by
obtain ⟨L,hpos,htr,he⟩ := purification_filter_recovery R hR P hP
have hh i j : trace ((p.purifiedOutput P i j).value Set.univ) =
trace ((p.canonicalOutput R i j).value Set.univ) := by
rw [← htr]
simpa only [purifiedOutput, canonicalOutput, PositiveMatrixMeasure.filter_value] using
congrArg trace (he ((p.probeOutput i j).value Set.univ))
simp_rw [Matrix.trace_sum,Complex.re_sum,hh]
simpa only [Matrix.trace_sum,Complex.re_sum] using p.canonicalOutput_normalized R hR
def purifiedOutputDensity (P : Matrix (ι × η) κ ℂ) (ν : Measure (ℕ → M)) (i j : K) :
(ℕ → M) → Matrix κ κ ℂ := (p.purifiedOutput P i j).positiveDensity ν
end FiniteProtocol
end
section
open Matrix MeasureTheory Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator
universe v11165_0 v11165_1 v11165_2
variable {Ω : Type v11165_0} {ι : Type v11165_1} {K : Type v11165_2} [inst11165_0 : MeasurableSpace Ω] [inst11165_1 : Fintype ι] [inst11165_2 : DecidableEq ι]
[inst11165_3 : Fintype K] [inst11165_4 : DecidableEq K] {μ : Measure Ω}
universe v11171_0 v11171_1
structure KeyDensity (μ : Measure Ω) (K : Type v11171_0) (ι : Type v11171_1) [Fintype K] [Fintype ι] [DecidableEq ι] where
block : K → K → Ω → Matrix ι ι ℂ
measurable : ∀ a b, Measurable (block a b)
positive : ∀ a b t, (block a b t).PosSemidef
integrable : ∀ a b, Integrable (fun t => (trace (block a b t)).re) μ
normalized : (∑ a, ∑ b, ∫ t, (trace (block a b t)).re ∂μ) = 1
universe v11179_0
structure EveDensity (μ : Measure Ω) (ι : Type v11179_0) [Fintype ι] [DecidableEq ι] where
block : Ω → Matrix ι ι ℂ
measurable : Measurable block
positive : ∀ t, (block t).PosSemidef
integrable : Integrable (fun t => (trace (block t)).re) μ
normalized : (∫ t, (trace (block t)).re ∂μ) = 1
namespace KeyDensity
variable (τ υ : KeyDensity μ K ι) (sigma : EveDensity μ ι)
def idealError : ℝ := cqDistance τ.block (fun a b t => idealFiniteBlocks (sigma.block t) a b) μ
def distance : ℝ := cqDistance τ.block υ.block μ
end KeyDensity
end
section
open Matrix MeasureTheory ProbabilityTheory Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator
open UnrestrictedQuantum
universe v11244_0 v11244_1 v11244_2 v11244_3 v11244_4 v11244_5 v11244_6 v11244_7 v11244_8 v11244_9 v11244_10 v11244_11
variable {O : Type v11244_0} {M : Type v11244_1} {ι : Type v11244_2} {η : Type v11244_3} [inst11244_0 : MeasurableSpace O] [inst11244_1 : MeasurableSpace M]
[inst11244_2 : StandardBorelSpace O] [inst11244_3 : Nonempty O] [inst11244_4 : StandardBorelSpace M] [inst11244_5 : Nonempty M]
[inst11244_6 : Fintype ι] [inst11244_7 : Fintype η] [inst11244_8 : DecidableEq ι] [inst11244_9 : DecidableEq η] [inst11244_10 : Nonempty ι] [inst11244_11 : Nonempty η]
{K : Type v11244_4} [inst11244_12 : MeasurableSpace K] [inst11244_13 : MeasurableSingletonClass K]
[inst11244_14 : Fintype K] [inst11244_15 : DecidableEq K] [inst11244_16 : Nonempty K]
{d : Discussion O M} {A : ℕ → Type v11244_5} {B : ℕ → Type v11244_6}
[inst11244_17 : ∀ n, AddCommGroup (A n)] [inst11244_18 : ∀ n, Module ℂ (A n)] [inst11244_19 : ∀ n, One (A n)] [inst11244_20 : ∀ n, LE (A n)]
[inst11244_21 : ∀ n, AddCommGroup (B n)] [inst11244_22 : ∀ n, Module ℂ (B n)] [inst11244_23 : ∀ n, One (B n)] [inst11244_24 : ∀ n, LE (B n)]
{TA : Type v11244_7} {TB : Type v11244_8} {CA : Type v11244_9} {CB : Type v11244_10}
[inst11244_25 : AddCommGroup TA] [inst11244_26 : Module ℂ TA] [inst11244_27 : One TA] [inst11244_28 : LE TA]
[inst11244_29 : AddCommGroup TB] [inst11244_30 : Module ℂ TB] [inst11244_31 : One TB] [inst11244_32 : LE TB]
[inst11244_33 : AddCommGroup CA] [inst11244_34 : Module ℂ CA] [inst11244_35 : One CA] [inst11244_36 : LE CA]
[inst11244_37 : AddCommGroup CB] [inst11244_38 : Module ℂ CB] [inst11244_39 : One CB] [inst11244_40 : LE CB]
{κ : Type v11244_11} [inst11244_41 : Fintype κ] [inst11244_42 : DecidableEq κ]
def FiniteProtocol.purifiedKeyDensity
(p : FiniteProtocol (ι := ι) (η := η) (K := K) d A B TA TB CA CB)
(R : Matrix (ι × η) (ι × η) ℂ) (hR : Density R)
(P : Matrix (ι × η) κ ℂ) (hP : P * Pᴴ = R)
(ν : Measure (ℕ → M)) [SigmaFinite ν] (hμν : d.transcriptLaw ≪ ν) : KeyDensity ν K κ where
block := p.purifiedOutputDensity P ν
measurable := fun i j => (p.purifiedOutput P i j).measurable_positiveDensity ν
positive := fun i j => (p.purifiedOutput P i j).positiveDensity_pos ν
integrable := fun i j => (p.purifiedOutput P i j).integrable_positiveDensity_trace ν
(fun S hS hz => p.purifiedOutput_ac P i j S hS (hμν hz))
normalized := by
have he i j := (p.purifiedOutput P i j).integral_positiveDensity_trace ν
(fun S hS hz => p.purifiedOutput_ac P i j S hS (hμν hz))
change (∑ i, ∑ j, ∫ t, (trace ((p.purifiedOutput P i j).positiveDensity ν t)).re ∂ν) = 1
simp_rw [he]
simpa only [Matrix.trace_sum,Complex.re_sum] using p.purifiedOutput_normalized R hR P hP
end
section
open Matrix MeasureTheory ProbabilityTheory Filter
section
universe u
def KeyWord : ℕ → Type
| 0 => Unit
| n+1 => Bool × KeyWord n
instance keyWordFintype (n : ℕ) : Fintype (KeyWord n) := by
induction n with
| zero => exact inferInstanceAs (Fintype Unit)
| succ n ih => letI := ih; exact inferInstanceAs (Fintype (Bool × KeyWord n))
instance keyWordDecidableEq (n : ℕ) : DecidableEq (KeyWord n) := by
induction n with
| zero => exact inferInstanceAs (DecidableEq Unit)
| succ n ih => letI := ih; exact inferInstanceAs (DecidableEq (Bool × KeyWord n))
instance keyWordNonempty (n : ℕ) : Nonempty (KeyWord n) := by
induction n with
| zero => exact inferInstanceAs (Nonempty Unit)
| succ n ih => let := ih; exact inferInstanceAs (Nonempty (Bool × KeyWord n))
instance keyWordMeasurableSpace (n : ℕ) : MeasurableSpace (KeyWord n) := by
induction n with
| zero => exact inferInstanceAs (MeasurableSpace Unit)
| succ n ih => letI := ih; exact inferInstanceAs (MeasurableSpace (Bool × KeyWord n))
instance keyWordMeasurableSingletonClass (n : ℕ) : MeasurableSingletonClass (KeyWord n) := by
induction n with
| zero => exact inferInstanceAs (MeasurableSingletonClass Unit)
| succ n ih => let := ih; exact inferInstanceAs (MeasurableSingletonClass (Bool × KeyWord n))
structure QuantumMemory where
Carrier : Type u
additive : AddCommGroup Carrier
complexModule : Module ℂ Carrier
unit : One Carrier
order : LE Carrier
attribute [instance] QuantumMemory.additive QuantumMemory.complexModule QuantumMemory.unit QuantumMemory.order
instance : CoeSort QuantumMemory (Type u) := ⟨QuantumMemory.Carrier⟩
structure ClassicalRecordSpace where
Carrier : Type u
measurableSpace : MeasurableSpace Carrier
standardBorel : StandardBorelSpace Carrier
nonempty : Nonempty Carrier
attribute [instance] ClassicalRecordSpace.measurableSpace ClassicalRecordSpace.standardBorel ClassicalRecordSpace.nonempty
instance : CoeSort ClassicalRecordSpace (Type u) := ⟨ClassicalRecordSpace.Carrier⟩
end
open Matrix MeasureTheory ProbabilityTheory Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator
universe u
structure KeyImplementation (a b ell : ℕ) (messages : ClassicalRecordSpace.{u}) where
outcomes : ClassicalRecordSpace.{u}
discussion : Discussion outcomes messages
memoryA : ℕ → QuantumMemory.{u}
memoryB : ℕ → QuantumMemory.{u}
incomingMemoryA : QuantumMemory.{u}
incomingMemoryB : QuantumMemory.{u}
outgoingMemoryA : QuantumMemory.{u}
outgoingMemoryB : QuantumMemory.{u}
protocol : FiniteProtocol (ι := Fin a) (η := Fin b) (K := KeyWord ell) discussion
(fun n => memoryA n) (fun n => memoryB n)
incomingMemoryA incomingMemoryB outgoingMemoryA outgoingMemoryB
namespace KeyImplementation
variable {a b ell : ℕ} {messages : ClassicalRecordSpace.{u}}
[inst11471_0 : Nonempty (Fin a)] [inst11471_1 : Nonempty (Fin b)]
(p : KeyImplementation a b ell messages)
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R)
{e : ℕ} (P : Matrix (Fin a × Fin b) (Fin e) ℂ) (hP : P * Pᴴ = R)
(ν : Measure (ℕ → messages)) [inst11471_2 : SigmaFinite ν] (hμν : p.discussion.transcriptLaw ≪ ν)
def output : KeyDensity ν (KeyWord ell) (Fin e) :=
p.protocol.purifiedKeyDensity R hR P hP ν hμν
end KeyImplementation
def IsCompletedKeyOutput {a b ell e : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)]
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (_hR : Density R)
(P : Matrix (Fin a × Fin b) (Fin e) ℂ) (_hP : P * Pᴴ = R)
(messages : ClassicalRecordSpace.{u}) (ν : Measure (ℕ → messages)) [SigmaFinite ν]
(τ : KeyDensity ν (KeyWord ell) (Fin e)) : Prop :=
∃ p : ℕ → KeyImplementation a b ell messages,
∃ _hAC : ∀ j, (p j).discussion.transcriptLaw ≪ ν,
Tendsto (fun j => cqDistance
(fun a b => positiveEntryDensity
(publicPurifiedEntries (p j).discussion.probeLaw
(p j).discussion.sampler.publicRecord (p j).protocol.completeReference P a b) ν)
τ.block ν) atTop (nhds 0)
theorem isCompletedKeyOutput_iff_original {a b ell e : ℕ}
[Nonempty (Fin a)] [Nonempty (Fin b)]
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R)
(P : Matrix (Fin a × Fin b) (Fin e) ℂ) (hP : P * Pᴴ = R)
(messages : ClassicalRecordSpace.{u}) (ν : Measure (ℕ → messages)) [SigmaFinite ν]
(τ : KeyDensity ν (KeyWord ell) (Fin e)) :
IsCompletedKeyOutput R hR P hP messages ν τ ↔
∃ p : ℕ → KeyImplementation a b ell messages,
∃ hAC : ∀ j, (p j).discussion.transcriptLaw ≪ ν,
Tendsto (fun j => ((p j).output R hR P hP ν (hAC j)).distance τ) atTop (nhds 0) :=
Iff.rfl
structure CompletedKeyTrial {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)]
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) (ell : ℕ) where
messages : ClassicalRecordSpace.{u}
eveDim : ℕ
purification : Matrix (Fin a × Fin b) (Fin eveDim) ℂ
prepares : purification * purificationᴴ = R
referenceMeasure : Measure (ℕ → messages)
sigmaFinite : SigmaFinite referenceMeasure
actual : KeyDensity referenceMeasure (KeyWord ell) (Fin eveDim)
completed : @IsCompletedKeyOutput _ _ _ _ _ _ R hR purification prepares
messages referenceMeasure sigmaFinite actual
ideal : EveDensity referenceMeasure (Fin eveDim)
attribute [instance] CompletedKeyTrial.sigmaFinite
namespace CompletedKeyTrial
variable {a b ell : ℕ} [inst11550_0 : Nonempty (Fin a)] [inst11550_1 : Nonempty (Fin b)]
{R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} {hR : Density R}
(p : CompletedKeyTrial R hR ell)
def error : ℝ := p.actual.idealError p.ideal
end CompletedKeyTrial
end
section
open scoped ComplexOrder MatrixOrder Kronecker
open Matrix
def groupIndex (a b c d : ℕ) :
(Fin (a*c) × Fin (b*d)) ≃ ((Fin a × Fin b) × (Fin c × Fin d)) where
toFun i := (((finProdFinEquiv.symm i.1).1,(finProdFinEquiv.symm i.2).1),
((finProdFinEquiv.symm i.1).2,(finProdFinEquiv.symm i.2).2))
invFun i := (finProdFinEquiv (i.1.1,i.2.1),finProdFinEquiv (i.1.2,i.2.2))
left_inv i := by
apply Prod.ext <;> exact finProdFinEquiv.apply_symm_apply _
right_inv i := by simp
def groupTensor {a b c d : ℕ}
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ)
(S : Matrix (Fin c × Fin d) (Fin c × Fin d) ℂ) :
Matrix (Fin (a*c) × Fin (b*d)) (Fin (a*c) × Fin (b*d)) ℂ :=
(R ⊗ₖ S).submatrix (groupIndex a b c d) (groupIndex a b c d)
lemma trace_groupTensor {a b c d : ℕ}
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ)
(S : Matrix (Fin c × Fin d) (Fin c × Fin d) ℂ) :
trace (groupTensor R S) = trace R * trace S := by
rw [← trace_kronecker]
exact Equiv.sum_comp (groupIndex a b c d) (fun x => (R ⊗ₖ S) x x)
lemma Density.groupTensor {a b c d : ℕ}
{R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ}
{S : Matrix (Fin c × Fin d) (Fin c × Fin d) ℂ}
(hR : Density R) (hS : Density S) : Density (groupTensor R S) := by
refine ⟨(hR.1.kronecker hS.1).submatrix _,?_⟩
rw [trace_groupTensor,hR.2,hS.2,one_mul]
def copyDim (a : ℕ) : ℕ → ℕ
| 0 => a
| k+1 => copyDim a k * a
lemma copyDim_eq (a k : ℕ) : copyDim a k = a^(k+1) := by
induction k with
| zero => simp [copyDim]
| succ k ih => simp only [copyDim,ih,pow_succ]
def positiveCopies {a b : ℕ} (R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) :
(k : ℕ) → Matrix (Fin (copyDim a k) × Fin (copyDim b k))
(Fin (copyDim a k) × Fin (copyDim b k)) ℂ
| 0 => R
| k+1 => groupTensor (positiveCopies R k) R
end
section
open Matrix MeasureTheory ProbabilityTheory Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ENNReal
universe u
lemma Density.positiveCopies {a b : ℕ}
{R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} (hR : Density R) (k : ℕ) :
Density (positiveCopies R k) := by
induction k with
| zero => exact hR
| succ k ih => exact ih.groupTensor hR
instance positiveCopy_nonempty (a k : ℕ) [Nonempty (Fin a)] : Nonempty (Fin (copyDim a k)) := by
have ha : 0 < copyDim a k := by
induction k with
| zero => exact (show 0 < a from Fin.size_positive')
| succ k ih => exact Nat.mul_pos ih (show 0 < a from Fin.size_positive')
exact ⟨⟨0,ha⟩⟩
structure CompletedKeyScheme {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)]
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) where
length : ℕ → ℕ
trial : (k : ℕ) → CompletedKeyTrial.{u} (positiveCopies R k) (by
induction k with
| zero => exact hR
| succ k ih =>
refine ⟨(ih.1.kronecker hR.1).submatrix _, ?_⟩
change trace (groupTensor (positiveCopies R k) R) = 1
have ht := Equiv.sum_comp (groupIndex (copyDim a k) (copyDim b k) a b)
(fun x => (Matrix.kronecker (positiveCopies R k) R) x x)
change trace (groupTensor (positiveCopies R k) R) = trace (Matrix.kronecker (positiveCopies R k) R) at ht
rw [ht, Matrix.kronecker, trace_kronecker, ih.2, hR.2, one_mul]) (length k)
namespace CompletedKeyScheme
variable {a b : ℕ} [inst11756_0 : Nonempty (Fin a)] [inst11756_1 : Nonempty (Fin b)]
{R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ} {hR : Density R}
(s : CompletedKeyScheme.{u} R hR)
def error (k : ℕ) : ℝ := (s.trial k).error
def Secure : Prop := Tendsto s.error atTop (nhds 0)
def lowerRate : ℝ≥0∞ := liminf (fun k : ℕ => (s.length k : ℝ≥0∞) / (k+1 : ℕ)) atTop
end CompletedKeyScheme
def distillableSecretKey {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)]
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) : ℝ≥0∞ :=
sSup {r | r = 0 ∨ ∃ s : CompletedKeyScheme.{u} R hR, s.Secure ∧ r = s.lowerRate}
end
open Matrix MeasureTheory ProbabilityTheory Filter
open scoped ComplexOrder MatrixOrder Matrix.Norms.L2Operator ENNReal
universe u
def UniformProtocolGap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)]
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (_hR : Density R) : Prop :=
∀ (k : ℕ) (O M : Type u) [MeasurableSpace O] [MeasurableSpace M]
[StandardBorelSpace O] [Nonempty O] [StandardBorelSpace M] [Nonempty M]
(d : Discussion O M) (A B : ℕ → Type u)
[∀ n, AddCommGroup (A n)] [∀ n, Module ℂ (A n)] [∀ n, One (A n)] [∀ n, LE (A n)]
[∀ n, AddCommGroup (B n)] [∀ n, Module ℂ (B n)] [∀ n, One (B n)] [∀ n, LE (B n)]
(TA TB CA CB : Type u)
[AddCommGroup TA] [Module ℂ TA] [One TA] [LE TA]
[AddCommGroup TB] [Module ℂ TB] [One TB] [LE TB]
[AddCommGroup CA] [Module ℂ CA] [One CA] [LE CA]
[AddCommGroup CB] [Module ℂ CB] [One CB] [LE CB]
(p : BitProtocol (ι := Fin (copyDim a k)) (η := Fin (copyDim b k)) d A B TA TB CA CB)
(e : ℕ) (P : Matrix (Fin (copyDim a k) × Fin (copyDim b k)) (Fin e) ℂ)
(_hP : P * Pᴴ = positiveCopies R k)
(sigma : PositiveMatrixMeasure (ℕ → M) (Fin e)),
(trace (sigma.value Set.univ)).re = 1 →
1/5 ≤ p.rawPurifiedSecretBitError P sigma
def UniformCompletedGap {a b : ℕ} [Nonempty (Fin a)] [Nonempty (Fin b)]
(R : Matrix (Fin a × Fin b) (Fin a × Fin b) ℂ) (hR : Density R) : Prop :=
∀ (k ell : ℕ), 0 < ell →
∀ p : CompletedKeyTrial.{u} (positiveCopies R k) (by
induction k with
| zero => exact hR
| succ k ih =>
refine ⟨(ih.1.kronecker hR.1).submatrix _, ?_⟩
change trace (groupTensor (positiveCopies R k) R) = 1
have ht := Equiv.sum_comp (groupIndex (copyDim a k) (copyDim b k) a b)
(fun x => (Matrix.kronecker (positiveCopies R k) R) x x)
change trace (groupTensor (positiveCopies R k) R) = trace (Matrix.kronecker (positiveCopies R k) R) at ht
rw [ht, Matrix.kronecker, trace_kronecker, ih.2, hR.2, one_mul]) ell,
1/5 ≤ p.error
namespace Explicit
lemma m_pos : 0 < m := by rw [m_eq]; exact Nat.mul_pos Q_pos D_pos
instance output_nonempty : Nonempty (Fin m) := by
have hb : 0 < b := by
unfold b
exact Nat.choose_pos (by decide)
have hq : 0 < Q := by unfold Q; exact pow_pos hb 3
have hd (q : ℕ) : 0 < dimensionFunction q := pow_pos (by decide) _
have hD : 0 < D := by unfold D; exact hd Q
have hm (q d : ℕ) (hq : 0 < q) (hd : 0 < d) :
0 < outputDimensionFunction q d := Nat.mul_pos hq hd
exact ⟨⟨0, by unfold m; exact hm Q D hq hD⟩⟩
def MainClaim : Prop :=
∃ hR : Density rhoFin, ¬ Separable rhoFin ∧
distillableSecretKey.{u} rhoFin hR = 0 ∧
UniformProtocolGap.{u} rhoFin hR ∧
UniformCompletedGap.{u} rhoFin hR
end Explicit
end ZeroKey
end
end OAI
|