File size: 218,686 Bytes
8cf8144 |
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 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 |
\pdfoutput=1
\documentclass{mscs}
\newif\ifexternalizetikz
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}
\usepackage{exscale}
\usepackage{graphicx,color}
\usepackage{etoolbox}
\usepackage{xparse}
\usepackage{xspace}
\usepackage{environ}
\usepackage{latexsym}
\usepackage{amssymb,amsmath}
\usepackage{mathtools}
\usepackage{stmaryrd}
\usepackage{cmll}
\usepackage{bm}
\usepackage{bussproofs}
\usepackage{nicefrac}
\usepackage{microtype}
\usepackage{comment} \usepackage{wrapfig}
\usepackage{listings}
\usepackage{fancybox}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.geometric}
\usetikzlibrary{shapes.gates.ee,shapes.gates.ee.IEC}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{cd}
\usetikzlibrary{decorations.pathmorphing}
\ifexternalizetikz
\usepackage{tikzcdx}
\usetikzlibrary{external}
\tikzexternalize[
prefix=tikzext/,
mode=list and make,
verbose IO=false,
]
\makeatletter
\newcommand{\tikzextname}[1]{\tikzset{external/figure name={\tikzexternal@realjob-#1-}}}
\makeatother
\fi
\makeatletter
\providecommand{\tikzextname}[1]{\@bsphack\@esphack}
\makeatother
\allowdisplaybreaks[1]
\usepackage[all,2cell]{xy}
\UseAllTwocells
\SelectTips{cm}{} \newdir{pb}{:(1,-1)@^{|-}}
\newcommand{\pb}[1]{\save[]+<17 pt,0 pt>:a(#1)\ar@{pb{}}[]\restore}
\newcommand{\shifted}[3]{\save[]!<#1,#2>*{#3}\restore}
\renewcommand{\arraystretch}{1.3}
\setlength{\arraycolsep}{2pt}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{example}[theorem]{Example}
\newtheorem{notation}[theorem]{Notation}
\newtheorem{assumption}[theorem]{Assumption}
\newenvironment{myproof}{\begin{proof}}{\end{proof}}
\newcommand{\qed}{\hspace*{\fill}\usebox{\proofbox}}
\newcommand{\QED}{\qed}
\newlength\stateheight
\setlength\stateheight{0.55cm}
\newlength\minimumstatewidth
\setlength\minimumstatewidth{0.8cm}
\tikzset{width/.initial=\minimummorphismwidth}
\tikzset{colour/.initial=white}
\newif\ifblack\pgfkeys{/tikz/black/.is if=black}
\newif\ifwedge\pgfkeys{/tikz/wedge/.is if=wedge}
\newif\ifvflip\pgfkeys{/tikz/vflip/.is if=vflip}
\newif\ifhflip\pgfkeys{/tikz/hflip/.is if=hflip}
\newif\ifhvflip\pgfkeys{/tikz/hvflip/.is if=hvflip}
\pgfdeclarelayer{foreground}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main,foreground}
\def\thickness{0.4pt}
\makeatletter
\pgfkeys{/tikz/on layer/.code={
\pgfonlayer{#1}\begingroup
\aftergroup\endpgfonlayer
\aftergroup\endgroup
},
/tikz/node on layer/.code={
\gdef\node@@on@layer{\setbox\tikz@tempbox=\hbox\bgroup\pgfonlayer{#1}\unhbox\tikz@tempbox\endpgfonlayer\pgfsetlinewidth{\thickness}\egroup}
\aftergroup\node@on@layer
},
/tikz/end node on layer/.code={
\endpgfonlayer\endgroup\endgroup
}
}
\def\node@on@layer{\aftergroup\node@@on@layer}
\makeatother
\makeatletter
\pgfdeclareshape{state}
{
\savedanchor\centerpoint
{
\pgf@x=0pt
\pgf@y=0pt
}
\anchor{center}{\centerpoint}
\anchorborder{\centerpoint}
\saveddimen\overallwidth
{
\pgf@x=3\wd\pgfnodeparttextbox
\ifdim\pgf@x<\minimumstatewidth
\pgf@x=\minimumstatewidth
\fi
}
\savedanchor{\upperrightcorner}
{
\pgf@x=.5\wd\pgfnodeparttextbox
\pgf@y=.5\ht\pgfnodeparttextbox
\advance\pgf@y by -.5\dp\pgfnodeparttextbox
}
\anchor{A}
{
\pgf@x=-\overallwidth
\divide\pgf@x by 4
\pgf@y=0pt
}
\anchor{B}
{
\pgf@x=\overallwidth
\divide\pgf@x by 4
\pgf@y=0pt
}
\anchor{text}
{
\upperrightcorner
\pgf@x=-\pgf@x
\ifhflip
\pgf@y=-\pgf@y
\advance\pgf@y by 0.4\stateheight
\else
\pgf@y=-\pgf@y
\advance\pgf@y by -0.4\stateheight
\fi
}
\backgroundpath
{
\begin{pgfonlayer}{foreground}
\pgfsetstrokecolor{black}
\pgfsetlinewidth{\thickness}
\pgfpathmoveto{\pgfpoint{-0.5*\overallwidth}{0}}
\pgfpathlineto{\pgfpoint{0.5*\overallwidth}{0}}
\ifhflip
\pgfpathlineto{\pgfpoint{0}{\stateheight}}
\else
\pgfpathlineto{\pgfpoint{0}{-\stateheight}}
\fi
\pgfpathclose
\ifblack
\pgfsetfillcolor{black!50}
\pgfusepath{fill,stroke}
\else
\pgfusepath{stroke}
\fi
\end{pgfonlayer}
}
}
\pgfdeclareshape{my ground}
{
\inheritsavedanchors[from=rectangle ee]
\inheritanchor[from=rectangle ee]{center}
\inheritanchor[from=rectangle ee]{north}
\inheritanchor[from=rectangle ee]{south}
\inheritanchor[from=rectangle ee]{east}
\inheritanchor[from=rectangle ee]{west}
\inheritanchor[from=rectangle ee]{north east}
\inheritanchor[from=rectangle ee]{north west}
\inheritanchor[from=rectangle ee]{south east}
\inheritanchor[from=rectangle ee]{south west}
\inheritanchor[from=rectangle ee]{input}
\inheritanchor[from=rectangle ee]{output}
\anchorborder{\csname pgf@anchor@my ground@input\endcsname}
\backgroundpath{
\pgf@process{\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}
\pgf@xa=\pgf@x \pgf@ya=\pgf@y
\pgf@process{\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}}
\pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
\pgfmathsetlength\pgf@xa{.5\pgf@xa+.5\pgf@xb}
\pgfmathsetlength\pgf@yc{.16666\pgf@yb-.16666\pgf@ya}
\advance\pgf@ya by\pgf@yc
\advance\pgf@yb by-\pgf@yc
\pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}
\advance\pgf@ya by\pgf@yc
\advance\pgf@yb by-\pgf@yc
\pgfpathmoveto{\pgfqpoint{\pgf@xb}{\pgf@ya}}
\pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}
}
}
\makeatother
\tikzset{inline text/.style =
{text height=1.2ex,text depth=0.25ex,yshift=0.5mm}}
\tikzset{arrow box/.style =
{rectangle,inline text,fill=white,draw,
minimum height=5mm,yshift=-0.5mm,minimum width=5mm}}
\tikzset{dot/.style =
{inner sep=0mm,minimum width=1mm,minimum height=1mm,
draw,shape=circle}}
\tikzset{white dot/.style = {dot,fill=white,text depth=-0.2mm}}
\tikzset{scalar/.style = {diamond,draw,inner sep=1pt}}
\tikzset{copier/.style = {dot,fill,text depth=-0.2mm}}
\tikzset{discarder/.style = {my ground,draw,inner sep=0pt,
minimum width=4.2pt,minimum height=11.2pt,anchor=input,rotate=90}}
\tikzset{xshiftu/.style = {shift = {(#1, 0)}}}
\tikzset{yshiftu/.style = {shift = {(0, #1)}}}
\tikzset{scriptstyle/.style={font=\everymath\expandafter{\the\everymath\scriptstyle}}}
\renewcommand{\emptyset}{\varnothing}
\let\Pr\relax
\DeclareMathOperator{\Pr}{P}
\NewEnviron{ctikzpicture}[1][]{\vcenter{\hbox{\begin{tikzpicture}[#1]\BODY\end{tikzpicture}}}}
\ifexternalizetikz
\makeatletter
\newcommand{\@ctikz}[2][]{\vcenter{\hbox{\begin{tikzpicture}[#1]#2\end{tikzpicture}}}}
\RenewEnviron{ctikzpicture}[1][]{\def\@@ctikz{\@ctikz[#1]}\expandafter\@@ctikz\expandafter{\BODY}}
\makeatother
\fi
\DeclareMathSymbol{\mhyphen}{\mathalpha}{operators}{"2D}
\ifdefined\mathsl\else
\DeclareMathAlphabet{\mathsl}{\encodingdefault}{\rmdefault}{\mddefault}{\sldefault}
\SetMathAlphabet{\mathsl}{bold}{\encodingdefault}{\rmdefault}{\bfdefault}{\sldefault}
\fi
\DeclareFontFamily{U}{mathux}{\hyphenchar\font45}
\DeclareFontShape{U}{mathux}{m}{n}{
<5> <6> <7> <8> <9> <10>
<10.95> <12> <14.4> <17.28> <20.74> <24.88>
mathux10
}{}
\DeclareSymbolFont{mathux}{U}{mathux}{m}{n}
\DeclareMathSymbol{\bigovee}{1}{mathux}{"8F}
\DeclareMathSymbol{\bigperp}{1}{mathux}{"4E}
\newcommand{\To}{\Rightarrow}
\newcommand{\Gets}{\Leftarrow}
\newcommand{\longto}{\longrightarrow}
\newcommand{\too}{\longrightarrow}
\newcommand{\longgets}{\longleftarrow}
\newcommand{\Longto}{\Longrightarrow}
\newcommand{\Too}{\Longrightarrow}
\newcommand{\Implies}{\Longrightarrow}
\newcommand{\Longgets}{\Longleftarrow}
\newcommand{\Iff}{\Longleftrightarrow}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\pRR}{\RR_{\geq 0}}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\RRpos}{\pRR}
\newcommand{\Set}{\mathbf{Set}}
\newcommand{\Cat}{\mathbf{Cat}}
\newcommand{\Fib}{\mathbf{Fib}}
\newcommand{\Poset}{\mathbf{Poset}}
\newcommand{\SET}{\mathbf{SET}}
\newcommand{\CAT}{\mathbf{CAT}}
\newcommand{\Hilb}{\mathbf{Hilb}}
\newcommand{\Meas}{\mathbf{Meas}}
\newcommand{\Pol}{\mathbf{Pol}}
\newcommand{\StB}{\Meas_{\mathrm{sb}}}
\newcommand{\sfKrn}{\mathbf{sfKrn}}
\newcommand{\pKrn}{\mathbf{pKrn}}
\newcommand{\pKrnsb}{\pKrn_{\mathrm{sb}}}
\newcommand{\Kl}{\mathcal{K}\mspace{-2mu}\ell}
\newcommand{\EM}{\mathcal{E}\mspace{-3mu}\mathcal{M}}
\newcommand{\id}{\mathrm{id}}
\newcommand{\Pow}{\mathcal{P}}
\newcommand{\Lft}{\mathcal{L}}
\newcommand{\Dst}{\mathcal{D}}
\newcommand{\Mlt}{\mathcal{M}}
\newcommand{\Giry}{\mathcal{G}}
\newcommand{\Firy}{\mathcal{F}}
\newcommand{\subG}{\Giry_s}
\newcommand{\Gsb}{\Giry_{\mathrm{sb}}}
\newcommand{\calE}{\mathcal{E}}
\newcommand{\calF}{\mathcal{F}}
\newcommand{\calG}{\mathcal{G}}
\newcommand{\calH}{\mathcal{H}}
\newcommand{\calK}{\mathcal{K}}
\newcommand{\calN}{\mathcal{N}}
\newcommand{\calU}{\mathcal{U}}
\newcommand{\calX}{\mathcal{X}}
\newcommand{\calY}{\mathcal{Y}}
\newcommand{\calZ}{\mathcal{Z}}
\newcommand{\op}{\mathrm{op}}
\newcommand{\st}{\mathrm{st}}
\newcommand{\dst}{\mathrm{dst}}
\newcommand{\bang}{\mathord{!}}
\newcommand{\bangop}{\mathop{!}}
\newcommand{\ques}{\mathord{?}}
\newcommand{\quesop}{\mathop{?}}
\newcommand{\commacat}[2]{(#1\mathbin{\downarrow}#2)}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\Fix}{Fix}
\DeclareMathOperator{\Hom}{Hom}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\dom}{dom}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\DeclarePairedDelimiter{\bra}{\langle}{\rvert}
\DeclarePairedDelimiter{\ket}{\lvert}{\rangle}
\DeclarePairedDelimiter{\tup}{\langle}{\rangle}
\DeclarePairedDelimiter{\cotup}{[}{]}
\DeclarePairedDelimiter{\sem}{\llbracket}{\rrbracket}
\DeclarePairedDelimiter{\card}{\lvert}{\rvert}
\DeclarePairedDelimiter{\innp}{\langle}{\rangle}
\newcommand{\setout}[2]{\{#1\;|\;#2\}}
\newcommand{\setin}[3]{\{#1\in#2\;|\;#3\}}
\newcommand{\all}[2]{\forall#1.\,#2}
\newcommand{\allin}[3]{\forall#1\in#2.\,#3}
\newcommand{\ex}[2]{\exists#1.\,#2}
\newcommand{\exin}[3]{\exists#1\in#2.\,#3}
\newcommand{\lam}[2]{\lambda#1.\,#2}
\newcommand{\lamin}[3]{\lambda#1\in#2.\,#3}
\newcommand{\given}{\mathbin{|}}
\newcommand{\Given}{\mathbin{\|}}
\DeclarePairedDelimiterX{\paren}[1]{(}{)}{\renewcommand{\given}{\mathbin{}\mathclose{}\delimsize\vert\mathopen{}\mathbin{}}#1}
\newcommand{\inprod}[2]{\langle#1, #2\rangle}
\DeclarePairedDelimiterX{\set}[1]{\lbrace}{\rbrace}
{\mybrconvii{\mathrel{}\mathclose{}\delimsize\vert\mathopen{}\mathrel{}}{#1}}
\DeclarePairedDelimiterX{\braket}[1]{\langle}{\rangle}
{\mybrconviii{\mathclose{}\delimsize\vert\mathopen{}}{#1}}
\NewDocumentCommand\mybrconvii{m >{\SplitArgument{1}{|}}m}{\mybrconvauxii{#1}#2}
\NewDocumentCommand\mybrconviii{m >{\SplitArgument{2}{|}}m}{\mybrconvauxiii{#1}#2}
\NewDocumentCommand\mybrconvauxii{mmm}{\IfNoValueTF{#3}{#2}{#2#1#3}}
\NewDocumentCommand\mybrconvauxiii{mmmm}{\IfNoValueTF{#3}{#2}{\mybrconvauxii{#1}{#2#1#3}{#4}}}
\newcommand{\cat}[1]{\mathbf{#1}}
\newcommand{\catA}{\cat{A}}
\newcommand{\catB}{\cat{B}}
\newcommand{\catC}{\cat{C}}
\newcommand{\catD}{\cat{D}}
\newcommand{\catE}{\cat{E}}
\newcommand{\catJ}{\cat{J}}
\newcommand{\catP}{\cat{P}}
\newcommand{\catQ}{\cat{Q}}
\newcommand{\catR}{\cat{R}}
\newcommand{\longhookrightarrow}{\lhook\joinrel\longrightarrow}
\newcommand{\longtwoheadrightarrow}{\relbar\joinrel\twoheadrightarrow}
\newcommand{\longrightharpoonup}{\relbar\joinrel\rightharpoonup}
\makeatletter
\newcommand{\mapsfromfill@}{\arrowfill@\leftarrow\relbar{\relbar\mapsfromchar}}
\newcommand{\xmapsfrom}[2][]{\ext@arrow 3095\mapsfromfill@{#1}{#2}}
\makeatother
\makeatletter
\newcommand{\mathoverlap}[2]{\mathpalette\mathoverlap@{{#1}{#2}}}
\newcommand{\mathoverlap@}[2]{\mathoverlap@@{#1}#2}
\newcommand{\mathoverlap@@}[3]{\ooalign{$\m@th#1#2$\crcr\hidewidth$\m@th#1#3$\hidewidth}}
\makeatother
\newcommand{\klcirc}{\mathbin{\mathoverlap{\circ}{\cdot}}}
\newcommand{\klto}{\mathrel{\mathoverlap{\rightarrow}{\mapstochar\,}}}
\newcommand{\longklto}{\mathrel{\mathoverlap{\longrightarrow}{\mapstochar\,}}}
\newcommand{\pklcirc}{\klcirc'}
\newcommand{\pklto}{\mathrel{\mathoverlap{\rightharpoonup}{\mapstochar\,}}}
\newcommand{\longpklto}{\mathrel{\mathoverlap{\longrightharpoonup}{\mapstochar\,}}}
\newcommand{\potimes}{\otimes'}
\newcommand{\pklin}[1]{\klin{#1}'}
\newcommand{\pkltuple}[1]{\kltuple{#1}'}
\newcommand{\krnto}{\rightsquigarrow}
\newcommand{\klar}{\ar|-@{|}}
\newcommand{\pklar}{\ar@{-^>}|-@{|}}
\makeatletter
\NewDocumentCommand\mathrotatebox{omm}{\IfNoValueTF{#1}
{\mathpalette\mathrotatebox@i{{#2}{#3}}}
{\mathpalette\mathrotatebox@ii{{#1}{#2}{#3}}}}
\newcommand{\mathrotatebox@i}[2]{\mathrotatebox@i@{#1}#2}
\newcommand{\mathrotatebox@i@}[3]{\rotatebox{#2}{$\m@th#1#3$}}
\newcommand{\mathrotatebox@ii}[2]{\mathrotatebox@ii@{#1}#2}
\newcommand{\mathrotatebox@ii@}[4]{\rotatebox[#2]{#3}{$\m@th#1#4$}}
\makeatother
\newcommand{\invbang}{\mathord{\mathrotatebox[origin=c]{180}{!}}}
\newcommand{\dd}{\mathrm{d}} \newcommand{\eqae}{=_{\mathrm{a.e.}}}
\newcommand{\subsetae}{\subseteq_{\mathrm{a.e.}}}
\newcommand{\Linfty}{L^{\infty}}
\newcommand{\Lone}{L^1}
\newcommand{\Lzero}{L^0}
\newcommand{\LLinfty}{\mathcal{L}^{\infty}}
\newcommand{\LLone}{\mathcal{L}^1}
\newcommand{\Exp}{\mathbb{E}}
\newcommand{\Lik}{\mathcal{L}}
\newcommand{\one}{\mathbf{1}}
\newcommand{\indic}[1]{\one_{#1}}
\newcommand{\Bo}{\mathcal{B}\mspace{-1mu}o}
\makeatletter
\NewDocumentCommand\mathraisebox{moom}{\IfNoValueTF{#2}
{\mathpalette\mathraisebox@i{{#1}{#4}}}
{\IfNoValueTF{#3}
{\mathpalette\mathraisebox@ii{{#1}{#2}{#4}}}
{\mathpalette\mathraisebox@iii{{#1}{#2}{#3}{#4}}}}}
\newcommand{\mathraisebox@i}[2]{\mathraisebox@i@{#1}#2}
\newcommand{\mathraisebox@i@}[3]{\raisebox{#2}{$\m@th#1#3$}}
\newcommand{\mathraisebox@ii}[2]{\mathraisebox@ii@{#1}#2}
\newcommand{\mathraisebox@ii@}[4]{\raisebox{#2}[#3]{$\m@th#1#4$}}
\newcommand{\mathraisebox@iii}[2]{\mathraisebox@iii@{#1}#2}
\newcommand{\mathraisebox@iii@}[5]{\raisebox{#2}[#3][#4]{$\m@th#1#5$}}
\makeatother
\newcommand{\Pred}{\mathsl{Pred}}
\newcommand{\Stat}{\mathsl{Stat}}
\newcommand{\SStat}{\mathsl{SStat}}
\newcommand{\andthen}{\mathbin{\&}}
\newcommand{\instr}{\mathrm{instr}}
\newcommand{\asrt}{\mathrm{asrt}}
\newcommand{\trup}{\mathbf{1}}
\newcommand{\falp}{\mathbf{0}}
\newcommand{\domp}{\mathrm{dp}}
\newcommand{\nrm}{\mathrm{nrm}}
\newcommand{\pproj}{\mathord{\vartriangleright}}
\newcommand{\cmpr}[2]{\{#1|{\kern.2ex}#2\}}
\newcommand{\pcp}{\mathrm{pcp}}
\newcommand{\rcp}{\mathrm{rcp}}
\newcommand{\gr}{\mathrm{gr}}
\newcommand{\Cv}{\mathrm{cv}}
\newcommand{\bc}{\mathrm{bc}}
\newcommand{\wgt}{\mathrm{wgt}}
\newcommand{\ga}{\mathsf{ga}}
\newcommand{\after}{\circ}
\newcommand{\klafter}{\klcirc}
\newcommand{\scalar}{\mathrel{\bullet}}
\newcommand{\idmap}[1][]{\mathrm{id}_{#1}}
\newcommand{\zero}{\mathbf{0}}
\newcommand{\dirac}[1]{\partial_{#1}}
\newcommand{\img}{\mathrm{im}}
\newcommand{\kerbot}{\ker^{\bot}}
\newcommand{\imgbot}{\img^{\bot}}
\newcommand{\tuple}[1]{\langle#1\rangle}
\newcommand{\dtupleleft}{\langle\!\langle}
\newcommand{\dtupleright}{\rangle\!\rangle}
\newcommand{\dtuple}[1]{\dtupleleft#1\dtupleright}
\newcommand{\kltuple}[1]{\tuple{#1}_{\!\scriptscriptstyle\otimes}}
\newcommand{\bigket}[1]{\ket[\big]{#1}}
\newcommand{\df}{\coloneqq}
\DeclareSymbolFont{T1op}{T1}{cmr}{m}{n}
\SetSymbolFont{T1op}{bold}{T1}{cmr}{bx}{n}
\DeclareMathSymbol{\mathguilsinglleft}{\mathopen}{T1op}{'016}
\DeclareMathSymbol{\mathguilsinglright}{\mathclose}{T1op}{'017}
\newcommand{\klin}[1]{\mathguilsinglleft#1\mathguilsinglright}
\newcommand{\EV}{\mathbb{E}}
\newcommand{\margsign}{\mathsf{M}}
\newcommand{\rotM}{\mathrotatebox[origin=c]{180}{\margsign}}
\newcommand{\weaksign}{\rotM}
\newcommand{\fW}{\weaksign_{1}}
\newcommand{\subfW}{\fW} \newcommand{\sW}{\weaksign_{2}}
\newcommand{\subsW}{\sW} \newcommand{\fM}{\margsign_{1}}
\newcommand{\sM}{\margsign_{2}}
\newcommand{\marg}[2]{\ensuremath{{#1}.{#2}}}
\newcommand{\disint}[2]{\ensuremath{{#1}\mathrel{\sslash}{#2}}}
\newcommand{\extract}[3]{\ensuremath{{#1}.\big[\,{#2}\;\big|\;{#3}\,\big]}}
\newcommand{\no}[1]{#1^{\scriptscriptstyle \bot}} \newcommand{\ortho}{\mathop{\sim}}
\renewcommand{\tt}{\ensuremath{tt}}
\newcommand{\intd}{{\kern.2em}\mathrm{d}{\kern.03em}}
\ifexternalizetikz\tikzexternaldisable\fi
\newsavebox\sbground
\savebox\sbground{\begin{tikzpicture}[baseline=0pt]
\draw (0,-.1ex) to (0,.85ex)
node[ground IEC,draw,anchor=input,inner sep=0pt,
minimum width=3.15pt,minimum height=8.4pt,rotate=90] {};
\end{tikzpicture}}
\newcommand{\ground}{\mathord{\usebox\sbground}}
\newsavebox\sbcopier
\savebox\sbcopier{\begin{tikzpicture}[baseline=0pt]
\node[copier,scale=.7] (a) at (0,3.6pt) {};
\draw (a) -- +(-90:.16);
\draw (a) -- +(45:.19);
\draw (a) -- +(135:.19);
\end{tikzpicture}}
\newcommand{\copier}{\mathord{\usebox\sbcopier}}
\ifexternalizetikz\tikzexternalenable\fi
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{10} \DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{10} \usepackage{color}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\newcommand\pythonstyle{\lstset{
backgroundcolor = \color{lightgray},
language=Python,
basicstyle=\ttm,
otherkeywords={self,>>>,...}, keywordstyle=\ttb\color{deepblue},
emph={MyClass,__init__}, emphstyle=\ttb\color{deepred}, stringstyle=\color{deepgreen},
frame=tb, showstringspaces=false }}
\lstnewenvironment{python}[1][]
{
\pythonstyle
\lstset{#1}
}
{}
\newcommand\pythoninline[1]{{\pythonstyle\lstinline!#1!}}
\newcommand{\EfProb}{\textit{EfProb}\xspace}
\newcommand{\Python}{\textrm{Python}\xspace}
\NewDocumentCommand{\equpto}{o}{\IfNoValueTF{#1}{\sim}{\overset{#1}{\sim}}}
\newcommand{\Coupl}{\mathrm{Coupl}}
\newcommand{\Caus}{\mathrm{Caus}}
\newcommand{\cind}[3]{#1\Perp#2\mid#3}
\title[Disintegration and Bayesian Inversion]{Disintegration and Bayesian Inversion via String Diagrams}
\author[K. Cho and B. Jacobs]{K\ls E\ls N\ls T\ls A\ns
C\ls H\ls O$^{\dagger}$\ns
and\ns
B\ls A\ls R\ls T\ns
J\ls A\ls C\ls O\ls B\ls S$^{\ddagger}$\\
$^{\dagger}$National Institute of Informatics\addressbreak
2-1-2 Hitotsubashi, Chiyoda-ku, Tokyo 101-8430, Japan\addressbreak
Email: {\normalfont\ttfamily cho@nii.ac.jp}\addressbreak
$^{\ddagger}$Institute for Computing and Information Sciences,
Radboud University\addressbreak
P.O.Box 9010, 6500 GL Nijmegen, the Netherlands\addressbreak
Email: {\normalfont\ttfamily bart@cs.ru.nl}}
\journal{} \date{31 August 2017; revised 7 December 2018}
\begin{document}
\maketitle
\begin{abstract}
The notions of disintegration and Bayesian inversion are fundamental
in conditional probability theory. They produce channels, as
conditional probabilities, from a joint state, or from an already
given channel (in opposite direction). These notions exist in the
literature, in concrete situations, but are presented here in abstract
graphical formulations. The resulting abstract descriptions are used
for proving basic results in conditional probability theory. The
existence of disintegration and Bayesian inversion is discussed for
discrete probability, and also for measure-theoretic probability --- via
standard Borel spaces and via likelihoods. Finally, the usefulness of
disintegration and Bayesian inversion is illustrated in several
examples.
\end{abstract}
\section{Introduction}
\tikzextname{s_intro}
The essence of conditional probability can be summarised informally in
the following equation about probability distributions:
$$\begin{array}{rcl}
\textit{joint}
& = &
\textit{conditional} \,\cdot\, \textit{marginal}.
\end{array}$$
\noindent A bit more precisely, when we have joint probabilities
$\Pr(x,y)$ for elements $x,y$ ranging over two sample spaces, the
above equation splits into two equations,
\begin{equation}
\label{eqn:conditionalprobability}
\begin{array}{rcccl}
\Pr(y \given x) \cdot \Pr(x)
& = &
\Pr(x,y)
& = &
\Pr(x\given y)\cdot \Pr(y),
\end{array}
\end{equation}
\noindent where $\Pr(x)$ and $\Pr(y)$ describe the marginals, which are
obtained by discarding variables. We see that conditional
probabilities $\Pr(y\given x)$ and $\Pr(x\given y)$ can be constructed in
two directions, namely $y$ given $x$, and $x$ given $y$. We also see
that we need to copy variables: $x$ on the left-hand-side of the
equations~\eqref{eqn:conditionalprobability}, and $y$ on the
right-hand-side.
Conditional probabilities play a crucial role in Bayesian probability
theory. They form the nodes of Bayesian
networks~\cite{Pearl88,BernardoS00,Barber12}, which reflect the
conditional independencies of the underlying joint distribution via
their graph structure. As part of our approach, we shall capture
conditional independence in an abstract manner.
The main notion of this paper is \emph{disintegration}. It is the
process of extracting a conditional probability from a joint
probability. Disintegration, as we shall formalise it here, gives a
structural description of the above
equation~\eqref{eqn:conditionalprobability} in terms of \emph{states}
and \emph{channels}. In general terms, a \emph{state} is a probability
distribution of some sort (discrete, measure-theoretic, or even quantum) and
a \emph{channel} is a map or morphism in a probabilistic setting, like
$\Pr(y\given x)$ and $\Pr(x\given y)$ as used above. It can take the form
of a stochastic matrix, probabilistic transition system, Markov
kernel, conditional probability table (in a Bayesian network), or
morphism in a Kleisli category of a `probability
monad'~\cite{Jacobs17}. A state is a special kind of channel, with
trivial domain. Thus we can work in a monoidal category of channels,
where we need discarding and copying --- more formally, a comonoid
structure on each object --- in order to express the above conditional
probability equations~\eqref{eqn:conditionalprobability}.
In this article we abstract away from interpretation details and will
describe disintegration pictorially, in the language of string
diagrams. This language can be seen as the internal language of
symmetric monoidal categories~\cite{Selinger2010} --- with comonoids
in our case. The essence of disintegration becomes: extracting a
conditional probability channel from a joint state.
Categorical approaches to Bayesian conditioning have appeared for
instance in~\cite{CulbertsonS2014,StatonYHKW16,ClercDDG2017} and
in~\cite{JacobsWW15a,JacobsZ16,Jacobs17}. The latter references use
effectus theory~\cite{Jacobs15d,ChoJWW15b}, a new comprehensive
approach aimed at covering the logic of both quantum theory and
probability theory, supported by a Python-based tool \EfProb, for
`effectus probability'. This tool is used for the (computationally
extensive) examples in this paper.
Disintegration, also known as regular conditional probability, is a
notoriously difficult operation in measure-theoretic probability, see
\textit{e.g.}~\cite{Pollard2002,Panangaden09,ChangP1997}: it may not
exist~\cite{Stoyanov2014}; even if it exists it may be determined only
up to negligible sets; and it may not be continuous or
computable~\cite{AckermanFR2011}. Disintegration has been studied
using categorical language in~\cite{CulbertsonS2014}, which focuses on
a specific category of probabilistic mappings.
Our approach here is more axiomatic.
We thus describe disintegration as going from a joint state to a
channel. A closely related concept is \emph{Bayesian inversion}: it
turns a channel (with a state) into a channel in opposite direction.
We show how Bayesian inversion can be understood and expressed easily
in terms of disintegration --- and also how, in the other direction,
disintegration can be obtained from Bayesian inversion. Bayesian
inversion is taken as primitive notion in~\cite{ClercDDG2017}. Here we
start from disintegration. The difference is a matter of choice.
Bayesian inversion is crucial for backward inference. We explain it
informally: let $\sigma$ be a state of a domain/type $X$, and $c\colon
X \rightarrow Y$ be a channel; Bayesian inversion yields a channel
$d\colon Y \rightarrow X$. Informally, it produces for an element
$y\in Y$, seen as singleton/point predicate $\{y\}$, the conditioning
of the state $\sigma$ with the pulled back evidence $c^{-1}(\{y\})$.
A concrete example involving such `point observations' will be
described at the end of Section~\ref{sec:likelihood}. More generally,
disintegration and Bayesian inversion are used to structurally
organise state updates in the presence of new evidence in probabilistic
programming, see
\textit{e.g.}~\cite{GordonHNRG14,BorgstromGGMG13,StatonYHKW16,KatoenGJKO2015}.
See also \cite{ShanR17}, where disintegration
is handled via symbolic manipulation.
Disintegration and Bayesian inversion are relatively easy to define in discrete
probability theory. The situation is much more difficult in measure-theoretic
probability theory, first of all because point predicates $\{y\}$ do
not make much sense there, see also~\cite{ChangP1997}.
A common solution to the problem of the existence of
disintegration / Bayesian inversion
is to restrict ourselves to standard Borel spaces, as in~\cite{ClercDDG2017}.
We take this approach too.
There is still an issue that disintegration is determined only up to negligible sets.
We address this by defining `almost equality'
in our abstract pictorial formulation.
This allows us to present a fundamental result from~\cite{ClercDDG2017} abstractly
in our setting, see Section~\ref{sec:equality}.
Another common, more concrete solution is to
assume a \emph{likelihood}, that is, a probabilistic relation $X\times
Y \rightarrow \pRR$. Such a likelihood gives rise to probability
density function (pdf), providing a good handle on the situation,
see~\cite{Pawitan01}. The technical core of
Section~\ref{sec:likelihood} is a generalisation of this
likelihood-based approach.
The paper is organised as follows. It starts with a brief introduction
to the graphical language that we shall be using, and to the
underlying monoidal categories with discarding and copying. Then,
Section~\ref{sec:disintegration} introduces both disintegration and
Bayesian inversion in this graphical language, and relates the two
notions. Subsequently, Section~\ref{sec:classifier} contains an
elaborated example, namely of naive Bayesian classification. A
standard example from the literature~\cite{WittenFH11} is redescribed
in the current setting: first, channels are extracted via
disintegration from a table with given data; next, Bayesian inversion
is applied to the combined extracted channels, giving the required
classification. This is illustrated in both the discrete and the
continuous version of the example.
Next, Section~\ref{sec:equality} is more technical and elaborates the
standard equality notion of `equal almost everywhere' in the current
setting. This is used for describing Bayesian inversion in a more
formal way,
following~\cite{ClercDDG2017}. Section~\ref{sec:conditionalindependence}
uses our graphical approach to review conditional independence and to
prove at an abstract level several known results, namely the equivalence
of various formulations of conditional independence, and the
`graphoid' axioms
from~\cite{VermaP1988,GeigerVP1990}. Section~\ref{sec:beyondcausal}
relaxes the requirement that maps are causal, so that `effects' can be
used as the duals of states for validity and conditioning. The main
result relates conditioning of joint states to forward and backward
inference via the extracted channels, in the style
of~\cite{JacobsZ16,JacobsZ18}; it is illustrated in a concrete
example, where a Bayesian network is seen as a graph in a Kleisli
category --- following~\cite{Fong12}. Finally,
Section~\ref{sec:likelihood} gives the likelihood formulation of
disintegration and inversion, as briefly described above.
\section{Graphical language}\label{sec:graphical}
\tikzextname{s_graphical}
The basic idea underlying this paper is to describe probability theory in terms of
\emph{channels}. A channel $f\colon X\to Y$ is a (stochastic) process
from a system of type $X$ into that of $Y$. Concretely, it may be a
probability matrix or kernel. Our standing assumption is that
types (as objects)
and channels (as arrows)
form a \emph{symmetric monoidal category}.
For the formal definition we refer to~\cite{MacLane1998}. We
informally summarise that we have the following constructions.
\begin{enumerate}
\item
Sequential composition
$g\circ f\colon X\to Z$
for appropriately typed channels $f\colon X\to Y$ and $g\colon Y\to Z$.
\item
Parallel composition
$f\otimes g\colon X\otimes Z\to Y\otimes W$
for $f\colon X\to Y$ and $g\colon Z\to W$.
This involves composition of types $X\otimes Z$.
\item
Identity channels $\id_X\colon X\to X$, which `do nothing'.
Thus $\id\circ f = f = \id\circ f$.
\item
A unit type $I$, which represents `no system'.
Thus $I\otimes X\cong X\cong X\otimes I$.
\item
Swap isomorphisms $X\otimes Y\cong Y\otimes X$ and associativity
isomorphisms $(X\otimes Y)\otimes Z \cong X\otimes (Y\otimes Z)$, so
the ordering in composed types does not matter.
\end{enumerate}
The representation of such channels in the ordinary `formula' notation
easily becomes complex and thus reasoning becomes hard to follow. A
graphical language known as \emph{string diagrams} offers a more
convenient and intuitive way of reasoning in a symmetric monoidal
category.
In string diagrams, types/objects are represented as wires
`\,\begin{tikzpicture}[baseline=-.6ex,y=1ex]
\draw (0,-1) -- (0,1);
\end{tikzpicture}\,', with information flowing bottom to top.
The composition of types is depicted by juxtaposition of wires, and
the unit type is `no diagram' as below.
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw (0,0) to +(0,1);
\node at (0.55,0.5) {$X\otimes Y$};
\end{tikzpicture}}}
=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw (0,0) to +(0,1);
\draw (0.5,0) to +(0,1);
\node at (0.2,0.5) {$X$};
\node at (0.7,0.5) {$Y$};
\end{tikzpicture}}}
\qquad\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw (0,0) to +(0,1);
\node at (0.2,0.5) {$I$};
\end{tikzpicture}}}
=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw [gray,dashed] (0,0) rectangle (0.7,1);
\end{tikzpicture}}}
\]
Channels/arrows are represented by boxes with an input wire(s) and an
output wire(s), in upward direction. When a box does not have input
or output, we write it as a triangle or diamond. For example, $f\colon
X\to Y\otimes Z$, $\omega\colon I\to X$, $p\colon X \to I$, and
$s\colon I\to I$ are respectively depicted as:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (v1) at (0,0) {\;\;$f$\;\;};
\draw (v1.north) ++(-0.2,0) -- +(0,0.35);
\draw (v1.north) ++(0.2,0) -- +(0,0.35);
\draw (v1.south) -- +(0,-0.35);
\node at (0.2,-0.5) {$X$};
\node at (-0.4,0.5) {$Y$};
\node at (0.4,0.5) {$Z$};
\end{tikzpicture}}}
\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega$};
\node (X) at (0,0.5) {};
\draw (omega) to (X);
\node at (0.2,0.35) {$X$};
\end{tikzpicture}}}
\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (p) at (0,0) {$p$};
\node (X) at (0,-0.5) {};
\draw (p) to (X);
\node at (0.2,-0.35) {$X$};
\end{tikzpicture}}}
\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[scalar] (c) at (-1,0.6) {$s$};
\end{tikzpicture}}}
\]
The identity channels are represented by `no box', \textit{i.e.}\ just wires,
and the swap isomorphisms are represented by crossing of wires:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$\id$};
\draw (c) to (0, 0.5);
\draw (c) to (0,-0.5);
\node at (0.2,0.6) {$X$};
\node at (0.2,-0.6) {$X$};
\end{tikzpicture}}}
=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw (0,0) to +(0,1);
\node at (0.2,0.5) {$X$};
\end{tikzpicture}}}
\qquad\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw (0,0) to (0.5,1);
\draw (0,1) to (0.5,0);
\node at (-0.2,0) {$X$};
\node at (0.7,1) {$X$};
\node at (0.7,0) {$Y$};
\node at (-0.2,1) {$Y$};
\end{tikzpicture}}}
\]
Finally, the sequential composition of channels is depicted by connecting
the input and output wires, and
the parallel composition is given by juxtaposition, respectively as below:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$g\circ f$};
\draw (c) to (0, 0.7);
\draw (c) to (0,-0.7);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (f) at (0,-1.5) {$f$};
\node[arrow box] (g) at (0,-0.8) {$g$};
\draw (g.north) to +(0,0.2);
\draw (f) to (g);
\draw (f.south) to +(0,-0.2);
\end{tikzpicture}}}
\qquad\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$h\otimes k$};
\draw (c) to (0, 0.6);
\draw (c) to (0,-0.6);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (h) at (0,0) {$h$};
\node[arrow box] (k) at (0.7,0) {$k$};
\draw (h) to +(0, 0.6);
\draw (h) to +(0,-0.6);
\draw (k) to +(0, 0.6);
\draw (k) to +(0,-0.6);
\end{tikzpicture}}}
\]
The use of string diagrams is justified by the following `coherence'
theorem;
see \cite{JoyalS1991,Selinger2010} for details.
\begin{theorem}
A well-formed equation between composites of arrows
in a symmetric monoidal category follows
from the axioms of symmetric monoidal categories if and only if
the string diagrams of both sides are equal
up to isomorphism of diagrams.
\qed
\end{theorem}
We further assume the following structure in our category.
For each type $X$ there are a discarder $\ground_X\colon X\to I$
and a copier $\copier_X\colon X\to X\otimes X$.
They are required to satisfy the following equations:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c) at (0,0) {};
\coordinate (x1) at (-0.3,0.3);
\node[discarder] (d) at (x1) {};
\coordinate (x2) at (0.3,0.5);
\draw (c) to[out=165,in=-90] (x1);
\draw (c) to[out=15,in=-90] (x2);
\draw (c) to (0,-0.3);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw (0,0) to (0,0.8);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c) at (0,0) {};
\coordinate (x1) at (-0.3,0.5);
\coordinate (x2) at (0.3,0.3);
\node[discarder] (d) at (x2) {};
\draw (c) to[out=165,in=-90] (x1);
\draw (c) to[out=15,in=-90] (x2);
\draw (c) to (0,-0.3);
\end{tikzpicture}}}
\qquad\qquad\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c2) at (0,0) {};
\node[copier] (c1) at (-0.3,0.3) {};
\draw (c2) to[out=165,in=-90] (c1);
\draw (c2) to[out=15,in=-90] (0.4,0.6);
\draw (c1) to[out=165,in=-90] (-0.6,0.6);
\draw (c1) to[out=15,in=-90] (0,0.6);
\draw (c2) to (0,-0.3);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c2) at (-0.5,0) {};
\node[copier] (c1) at (-0.2,0.3) {};
\draw (c2) to[out=15,in=-90] (c1);
\draw (c2) to[out=165,in=-90] (-1,0.6);
\draw (c1) to[out=165,in=-90] (-0.5,0.6);
\draw (c1) to[out=15,in=-90] (0.1,0.6);
\draw (c2) to (-0.5,-0.3);
\end{tikzpicture}}}
\qquad\qquad\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c) at (0,0.4) {};
\draw (c)
to[out=15,in=-90] (0.25,0.7)
to[out=90,in=-90] (-0.25,1.4);
\draw (c)
to[out=165,in=-90] (-0.25,0.7)
to[out=90,in=-90] (0.25,1.4);
\draw (c) to (0,0.1);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c) at (0,0.4) {};
\draw (c)
to[out=15,in=-90] (0.25,0.7);
\draw (c)
to[out=165,in=-90] (-0.25,0.7);
\draw (c) to (0,0.1);
\end{tikzpicture}}}
\]
This says that $(\copier_X, \ground_X)$ forms a commutative comonoid
on $X$. By the associativity we may write:
\[
\begin{ctikzpicture}[font=\small]
\node[copier] (c3) at (0,0) {};
\draw (0,-0.2) to (c3);
\draw (c3) to[out=165,in=-90] (-0.6,0.4);
\draw (c3) to[out=160,in=-90] (-0.4,0.4);
\draw (c3) to[out=150,in=-90] (-0.2,0.4);
\draw (c3) to[out=15,in=-90] (0.6,0.4);
\node[font=\normalsize] at (0.2,0.3) {$\dots$};
\end{ctikzpicture}
\;\;\coloneqq\;\;
\begin{ctikzpicture}[font=\small]
\node[copier] (c2) at (-0.1,0.2) {};
\node[copier] (c1) at (-0.3,0.4) {};
\node[copier] (c3) at (0.5,-0.1) {};
\draw (c2) to[out=165,in=-90] (c1);
\draw (c2) to[out=15,in=-90] (0.2,0.6);
\draw (c1) to[out=165,in=-90] (-0.5,0.6);
\draw (c1) to[out=15,in=-90] (-0.1,0.6);
\draw (0.5,-0.35) to (c3);
\draw (c3) to[out=15,in=-90] (0.85,0.6);
\node[font=\normalsize] at (0.5,0.25) {$\dots$};
\end{ctikzpicture}
\]
Moreover we assume that the comonoid structures $(\copier_X, \ground_X)$ are compatible
with the monoidal structure $(\otimes, I)$, in the sense that
the following equations hold.
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (d) at (0,0) {};
\draw (d) to +(0,-0.5);
\node at (0.6,-0.3) {$X\otimes Y$};
\end{tikzpicture}}}
=
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (d) at (0,0) {};
\node[discarder] (d2) at (0.6,0) {};
\draw (d) to +(0,-0.5);
\draw (d2) to +(0,-0.5);
\node at (0.2,-0.3) {$X$};
\node at (0.8,-0.3) {$Y$};
\end{tikzpicture}}}
\qquad\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (d) at (0,0) {};
\draw (d) to +(0,-0.5);
\node at (0.2,-0.3) {$I$};
\end{tikzpicture}}}
=\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw [gray,dashed] (0,0) rectangle (0.45,0.65);
\end{tikzpicture}}}
\qquad\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c) at (0,0.4) {};
\draw (c)
to[out=15,in=-90] (0.25,0.7);
\draw (c)
to[out=165,in=-90] (-0.25,0.7);
\draw (c) to (0,0);
\node at (0.6,0.1) {$X\otimes Y$};
\end{tikzpicture}}}
=
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c) at (0,0) {};
\node[copier] (c2) at (0.4,0) {};
\draw (c) to[out=15,in=-90] +(0.5,0.45);
\draw (c) to[out=165,in=-90] +(-0.4,0.45);
\draw (c) to +(0,-0.4);
\draw (c2) to[out=15,in=-90] +(0.4,0.45);
\draw (c2) to[out=165,in=-90] +(-0.5,0.45);
\draw (c2) to +(0,-0.4);
\node at (-0.2,-0.3) {$X$};
\node at (0.6,-0.3) {$Y$};
\end{tikzpicture}}}
\qquad\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (c) at (0,0.4) {};
\draw (c)
to[out=15,in=-90] (0.25,0.7);
\draw (c)
to[out=165,in=-90] (-0.25,0.7);
\draw (c) to (0,0);
\node at (0.2,0.1) {$I$};
\end{tikzpicture}}}
=\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\draw [gray,dashed] (0,0) rectangle (0.45,0.65);
\end{tikzpicture}}}
\]
Note that we do \emph{not} assume that
these maps are natural. Explicitly, we do not
necessarily have $\copier\circ f = (f\otimes f)\circ \copier$
or $\ground\circ f=\ground$.
We will use these
symmetric monoidal categories throughout in the paper.
For convenience, we introduce a term for them.
\begin{definition}
\label{def:cd-cat}
A \emph{CD-category} is
a symmetric monoidal category $(\catC,\otimes,I)$ with
a commutative comonoid $(\copier_X,\ground_X)$
for each $X\in\catC$, suitably compatible as described above.
\end{definition}
Here `CD' stands for Copy/Discard.
\begin{definition}
An arrow $f\colon X\to Y$ in a CD-category
is said to be \emph{causal} if
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$f$};
\node[discarder] (d) at (0,0.5) {};
\draw (c) to (d);
\draw (c) to (0,-0.5);
\end{tikzpicture}}}
\;=\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (d) at (0,0) {};
\draw (d) to (0,-0.5);
\end{tikzpicture}}}
\quad.
\]
\noindent A CD-category is \emph{affine} if all the arrows are causal,
or equivalently, the tensor unit $I$ is a final object.
\end{definition}
The term `causal' comes from (categorical) quantum
foundation~\cite{CoeckeK2017,DArianoCP2017}, and is related to
relativistic causality, see \textit{e.g.}~\cite{Coecke2016}.
We reserve the term `channel' for causal arrows. Explicitly, causal
arrows $c\colon X\to Y$ in a CD-category are called \emph{channels}.
A channel $\omega\colon I\to X$ with input type $I$ is called a
\emph{state} (on $X$).
For the time being
we will only use channels (and states), and thus only consider affine
CD-categories.
Non-causal arrows will not appear until
Section~\ref{sec:beyondcausal}.
Our main examples of affine CD-categories are two Kleisli categories
$\Kl(\Dst)$ and $\Kl(\Giry)$, respectively, for discrete probability,
and more general, measure-theoretic probability. We explain them in
order below. There are more examples, like the Kleisli category of the
non-empty powerset monad, or the (opposite of) the category of
commutative $C^*$-algebras (with positive unital maps), but they
are out of scope here.
\begin{example}
\label{ex:KlD}
What we call a \emph{distribution} or a \emph{state} over a set
$X$ is a finite subset $\{x_{1}, x_{2}, \ldots, x_{n}\} \subseteq
X$, called the support where each element $x_{i}$ occurs with a
multiplicity $r_{i} \in [0,1]$, such that $\sum_{i}r_{i}=1$. Such a
convex combination is often written as $r_{1}\ket{x_1} + \cdots +
r_{n}\ket{x_n}$ with $r_{i}\in[0,1]$. The ket notation $\ket{-}$ is
meaningless syntactic sugar that is used to distinguish elements
$x\in X$ from occurrences in such formal sums. Notice that a
distribution can also be written as a function $\omega \colon X
\rightarrow [0,1]$ with finite support $\supp(\omega) =
\setin{x}{X}{\omega(x) \neq 0}$. We shall write $\Dst(X)$ for the
set of distributions over $X$. This $\Dst$ is a monad on the
category $\Set$ of sets and functions.
A function $f\colon X \rightarrow \Dst(Y)$ is called a \emph{Kleisli}
map; it forms a channel $X \rightarrow Y$. Such maps can be composed
as matrices, for which we use special notation $\klafter$.
$$\begin{array}{rcl}
(g \klafter f)(x)(z)
& = &
\sum_{y\in Y} f(x)(y) \cdot g(y)(z) \qquad
\mbox{for $g\colon Y \rightarrow \Dst(Z)$ with $x\in X, z\in Z$.}
\end{array}$$
\noindent We write $1 = \{*\}$ for a singleton set, and $2 = 1+1 =
\{0,1\}$. Notice that $\Dst(1) \cong 1$ and $\Dst(2) \cong [0,1]$. We
can identify a state on $X$ with a channel $1 \rightarrow X$.
The monad $\Dst$ is known to be \emph{commutative}. This implies that
finite products of sets $X\times Y$ give rise to a symmetric monoidal
structure on the Kleisli category $\Kl(\Dst)$. Specifically, for two
maps $f\colon X\to \Dst(Y)$ and $g\colon Z\to \Dst(W)$, the tensor
product / parallel composition $f\otimes g\colon X\times Z\to
\Dst(Y\times W)$ is given by:
\[ \begin{array}{rcl}
(f\otimes g)(x,z)(y,w)
& = &
f(x,y)\cdot g(z,w).
\end{array}
\]
\noindent For each set $X$ there are a copier $\copier_X\colon X\to
\Dst(X\times X)$ and a discarder $\ground_X\colon X\to \Dst(1)$
given by $\copier_X(x)=1\ket{x,x}$
and $\ground_X(x)=1\ket{*}$, respectively.
They come from the cartesian
(finite product) structure of the base category $\Set$,
through the obvious functor $\Set\to\Kl(\Dst)$.
Therefore $\Kl(\Dst)$ is a
CD-category. It is moreover affine, since the monad is affine in the
sense that $\Dst(1)\cong 1$.
\end{example}
\begin{example}
\label{ex:KlG}
Let $X = (X, \Sigma_{X})$ be a measurable space, where
$\Sigma_{X}$ is a $\sigma$-algebra on $X$. A \emph{probability
measure}, also called a \emph{state}, on $X$ is a function $\omega
\colon \Sigma_{X} \rightarrow [0,1]$ which is countably additive and
satisfies $\omega(X) = 1$. We write $\Giry(X)$ for the collection of
all such probability measures on $X$. This set $\Giry(X)$ is itself
a measurable space with the smallest $\sigma$-algebra
such that
for each $A\in\Sigma_X$ the `evaluation' map
$\mathrm{ev}_A\colon \Giry(X)\to[0,1]$,
$\mathrm{ev}_A(\omega)=\omega(A)$,
is measurable.
Notice that $\Giry(X) \cong \Dst(X)$ when $X$ is
a finite set (as discrete space). In particular, $\Giry(2) \cong
\Dst(2) \cong [0,1]$. This $\Giry$ is a monad on the category
$\Meas$ of measurable spaces, with measurable functions between
them; it is called the Giry monad, after~\cite{Giry1982}.
A Kleisli map, that is, a measurable function $f\colon X \rightarrow
\Giry(Y)$ is a channel (or a \emph{probability kernel},
see Example~\ref{ex:CD-cat}). These channels can be
composed, via Kleisli composition $\klafter$, using integration\footnote{We denote
the integral of a function $f$
with respect to a measure $\mu$
by $\int_X f(x)\,\mu(\dd x)$.}:
\[
(g \klafter f)(x)(C)
=
\int_Y g(y)(C) \, f(x)(\dd y) \quad
\text{where $g\colon Y \rightarrow \Giry(Z)$ and $x\in X, C\in\Sigma_{Z}$.}
\]
It is well-known that the monad $\Giry$ is commutative and affine, see
also~\cite{Jacobs17}. Thus, in a similar manner to the previous
example, the Kleisli category $\Kl(\Giry)$ is an affine CD-category.
The parallel composition $f\otimes g\colon X\times Z\to \Giry(Y\times W)$
for $f\colon X\to \Giry(Y)$ and $g\colon Z\to \Giry(W)$ is given as:
\[ \begin{array}{rcl}
(f\otimes g)(x,z)(B\times D)
& = &
f(x)(B)\cdot g(z)(D),
\end{array}
\]
for $x\in X$, $z\in Z$, $B\in\Sigma_Y$, and $D\in\Sigma_W$.
Since $f(x)$ and $g(z)$ are ($\sigma$-)finite measures,
this indeed
determines a unique measure
$(f\otimes g)(x,z)\in \Giry(Y\times W)$,
namely the unique
product measure of $f(x)$ and $g(z)$.
Explicitly, for $E\in\Sigma_{Y\times W}$,
\[
(f\otimes g)(x,z)(E)
=
\int_{W}
\paren[\bigg]{
\int_{Y}
\indic{E}(y,w)\,
f(x)(\dd y)}
g(z)(\dd w)
\]
where $\indic{E}$ is the indicator function.
\end{example}
\section{Marginalisation, integration and disintegration}
\label{sec:disintegration}
\tikzextname{s_disint}
Let $\catC$ be an affine CD-category. We think of states
$\omega\colon I\to X$ in $\catC$ as abstract (probability)
distributions on type $X$. States of the form $\omega\colon I\to
X\otimes Y$, often called (bipartite) joint states, are seen as joint
distributions on $X$ and $Y$. Later on we shall also consider
$n$-partite joint states, but for the time being we restrict ourselves
to bipartite ones. For a joint distribution $\Pr(x,y)$ in discrete
probability, we can calculate the marginal distribution on $X$ by
summing (or marginalising) $Y$ out, as $\Pr(x)=\sum_y \Pr(x,y)$. The
marginal distribution on $Y$ is also calculated by $\Pr(y)=\sum_x
\Pr(x,y)$. In our abstract setting, given a joint state $\omega\colon
I\to X\otimes Y$, we can obtain marginal states simply by discarding
wires, as in:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.55) {};
\node [discarder] (ground) at (0.25,0.3) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (ground);
\node[scriptstyle] at (-0.45,0.4) {$X$};
\end{tikzpicture}}}
\quad\xmapsfrom{\text{marginal on $X$}}\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.55) {};
\coordinate (Y) at (0.25,0.55) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (Y);
\path[scriptstyle]
node at (-0.45,0.4) {$X$}
node at (0.45,0.4) {$Y$};
\end{tikzpicture}}}
\quad\xmapsto{\text{marginal on $Y$}}\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\node [discarder] (X) at (-0.25,0.3) {};
\coordinate (Y) at (0.25,0.55) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (Y);
\node[scriptstyle] at (0.45,0.4) {$Y$};
\end{tikzpicture}}}
\]
In other words, the marginal states are the state $\omega$ composed with the projection maps
$\pi_1\colon X\otimes Y\to X$ and $\pi_2\colon X\otimes Y\to Y$, as below.
\[
\pi_1 \coloneqq\;\;
\begin{ctikzpicture}[font=\small]
\node[discarder] (d) at (0,0.4) {};
\draw (0,0) to (d);
\draw (-0.35,0) to +(0,0.9);
\path[scriptstyle]
node at (-0.5,0.15) {$X$}
node at (0.15,0.15) {$Y$};
\end{ctikzpicture}
\qquad\qquad\qquad\qquad
\pi_2 \coloneqq\;\;
\begin{ctikzpicture}[font=\small]
\node[discarder] (d) at (-0.35,0.35) {};
\draw (-0.35,0) to (d);
\draw (0,0) to +(0,0.9);
\path[scriptstyle]
node at (-0.5,0.1) {$X$}
node at (0.15,0.1) {$Y$};
\end{ctikzpicture}
\]
\begin{example}
For a joint state $\omega\in\Dst(X\times Y)$ in $\Kl(\Dst)$,
the first marginal $\omega_1=\pi_1\klcirc\omega$ is given by
$\omega_1(x)=\sum_{y\in Y} \omega(x,y)$, as expected.
Similarly the second marginal is
given by $\omega_2(y)=\sum_{x\in X} \omega(x,y)$.
\end{example}
\begin{example}
For a joint state $\omega\in\Giry(X\times Y)$ in $\Kl(\Giry)$,
the first marginal is given by $\omega_1(A)=\omega(A\times Y)$
for $A\in\Sigma_X$,
and the second marginal by
$\omega_2(B)=\omega(X\times B)$ for $B\in\Sigma_Y$.
\end{example}
A channel $c\colon X\to Y$ is seen as an abstract \emph{conditional}
distribution $\Pr(y|x)$.
In (discrete) probability theory, we can
calculate a joint distribution $\Pr(x,y)$ from a distribution $\Pr(x)$
and a conditional distribution $\Pr(y|x)$ by the formula
$\Pr(x,y)=\Pr(y|x)\cdot\Pr(x)$,
which is often called the \emph{product rule}.
Similarly we have $\Pr(x,y)=\Pr(x|y)\cdot\Pr(y)$.
In our setting, starting from a
state $\sigma\colon I\to X$ and a channel $c\colon X\to Y$, or a state
$\tau\colon I\to Y$ and a channel $d\colon Y\to X$, we can
`integrate' them into a joint state on $X\otimes Y$ as follows, respectively:
\begin{equation}
\label{eq:joint-state}
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$c$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\path[scriptstyle]
node at (-0.7,1.45) {$X$}
node at (0.7,1.45) {$Y$};
\end{tikzpicture}}}
\qquad\qquad\text{or}\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\tau$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (-0.5,0.95) {$d$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90] (c);
\draw (copier) to[out=30,in=-90] (Y);
\draw (c) to (X);
\path[scriptstyle]
node at (-0.7,1.45) {$X$}
node at (0.7,1.45) {$Y$};
\end{tikzpicture}}}
\end{equation}
\begin{example}
Let $\sigma\in\Dst(X)$ and $c\colon X\to \Dst(Y)$
be a state and a channel in $\Kl(\Dst)$.
An easy calculation verifies that
$\omega=(\id\otimes c)\klcirc\copier\klcirc\sigma$, the joint state on $X\times Y$
defined as in~\eqref{eq:joint-state},
satisfies $\omega(x,y)=c(x)(y)\cdot\sigma(x)$, as we expect
from the product rule.
\end{example}
\begin{example}
For a state $\sigma\in\Giry(X)$ and a channel $c\colon X\to \Giry(Y)$
in $\Kl(\Giry)$, the joint state $\omega=(\id\otimes
c)\klcirc\copier\klcirc\sigma$ is given by $\omega(A\times B)=\int_A
c(x)(B)\, \sigma(\dd x)$ for $A\in\Sigma_X$ and $B\in\Sigma_Y$. This
`integration' construction of a joint probability measure is standard,
see \textit{e.g.}~\cite{Pollard2002,Panangaden09}.
\end{example}
\emph{Disintegration} is an inverse operation of
the `integration' of a state and a channel into a joint state, as in~\eqref{eq:joint-state}.
More specifically, it starts from a joint state $\omega\colon I\to X\otimes Y$
and extracts either a state $\omega_1\colon I\to X$ and a channel $c_1\colon X\to Y$,
or a state $\omega_2\colon I\to Y$ and a channel $c_2\colon Y\to X$ as below,
\[
\biggl(\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega_1$};
\node (X) at (0,0.5) {};
\draw (omega) to (X);
\node[scriptstyle] at (0.2,0.35) {$X$};
\end{tikzpicture}}}
\;,\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$c_1$};
\draw (c) to (0, 0.6);
\draw (c) to (0,-0.6);
\path[scriptstyle]
node at (0.2,0.6) {$Y$}
node at (0.2,-0.6) {$X$};
\end{tikzpicture}}}
\;\biggr)
\quad\xmapsfrom{\text{disintegration}}\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.55) {};
\coordinate (Y) at (0.25,0.55) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (Y);
\path[scriptstyle]
node at (-0.45,0.4) {$X$}
node at (0.45,0.4) {$Y$};
\end{tikzpicture}}}
\quad\xmapsto{\text{disintegration}}\quad
\biggl(\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega_2$};
\node (X) at (0,0.5) {};
\draw (omega) to (X);
\node[scriptstyle] at (0.2,0.35) {$Y$};
\end{tikzpicture}}}
\;,\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$c_2$};
\draw (c) to (0, 0.6);
\draw (c) to (0,-0.6);
\path[scriptstyle]
node at (0.2,0.6) {$X$}
node at (0.2,-0.6) {$Y$};
\end{tikzpicture}}}
\;\biggr)
\]
such that the equation on the left or right below holds, respectively.
\begin{equation}
\label{eqn:disintegrations}
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega_1$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$c_1$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\path[scriptstyle]
node at (-0.7,1.45) {$X$}
node at (0.7,1.45) {$Y$};
\end{tikzpicture}}}
\qquad=\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.55) {};
\coordinate (Y) at (0.25,0.55) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (Y);
\path[scriptstyle]
node at (-0.45,0.4) {$X$}
node at (0.45,0.4) {$Y$};
\end{tikzpicture}}}
\qquad=\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega_2$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (-0.5,0.95) {$c_2$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90] (c);
\draw (copier) to[out=30,in=-90] (Y);
\draw (c) to (X);
\path[scriptstyle]
node at (-0.7,1.45) {$X$}
node at (0.7,1.45) {$Y$};
\end{tikzpicture}}}
\end{equation}
We immediately see from the equation that
$\omega_{1}$ and $\omega_{2}$ must be marginals of $\omega$:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.55);
\node[discarder] (Y) at (0.25,0.25) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (Y);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega_1$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$c_1$};
\coordinate (X) at (-0.5,1.55);
\node[discarder] (Y) at (0.5,1.4) {};
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega_1$};
\node[copier] (copier) at (0,0.3) {};
\coordinate (X) at (-0.5,1.5);
\coordinate (c) at (0.5,0.91);
\node[discarder] (Y) at (c) {};
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega_1$};
\draw (omega) to (0,0.55);
\end{tikzpicture}}}
\]
and similarly
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\node[discarder] (X) at (-0.25,0.25) {};
\coordinate (Y) at (0.25,0.55) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (Y);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\omega_2$};
\draw (omega) to (0,0.55);
\end{tikzpicture}}}
\quad.
\]
Therefore
a disintegration of $\omega$
may be referred to by
a channel $c_i$ only,
rather than a pair $(\omega_i,c_i)$.
This leads to the following definition:
\begin{definition}
\label{def:disintegration}
Let $\omega\colon I\to X\otimes Y$ be a joint state.
A channel $c_1\colon X\to Y$
(or $c_2\colon Y\to X$) is called a \emph{disintegration} of $\omega$
if it satisfies the equation~\eqref{eqn:disintegrations}
with $\omega_i$ the marginals of $\omega$.
\end{definition}
Let us look at concrete instances of disintegrations,
in the Kleisli categories $\Kl(\Dst)$
and $\Kl(\Giry)$
from Examples~\ref{ex:KlD}
and~\ref{ex:KlG}.
\begin{example}
\label{ex:disintegration}
Let $\omega\in\Dst(X\times Y)$ be a joint state in $\Kl(\Dst)$.
We write $\omega_{1}
\in\Dst(X)$ for the first marginal, given by $\omega_{1}(x) =
\sum_{y}\omega(x,y)$.
Then a channel $c\colon X\to \Dst(Y)$ is a disintegration of $\omega$
if and only if $\omega(x,y)=c(x)(y)\cdot \omega_1(x)$
for all $x\in X$ and $y\in Y$.
It turns out that there is always such a channel $c$.
We define a channel $c$ by:
\begin{equation}
\label{eqn:discrete:disintegration}
\begin{array}{rcl}
c(x)(y)
& \coloneqq &
\frac{\omega(x,y)}{\omega_{1}(x)}
\qquad\qquad
\text{if}\quad\omega_1(x)\neq 0
\enspace,
\end{array}
\end{equation}
\noindent
and $c(x)\coloneqq\tau$ if $\omega_1(x)=0$, for an arbitrary state $\tau\in\Dst(Y)$.
(Here $\Dst(Y)$ is nonempty, since so is $\Dst(X\times Y)$.)
This indeed defines a channel $c$ satisfying the required equation.
Roughly speaking, disintegration in discrete probability
is nothing but the `definition'
of conditional probability: $\Pr(y|x)=\Pr(x,y)/\Pr(x)$.
There is still some subtlety --- disintegrations need not be unique,
when there are $x\in X$ with $\omega_1(x)=0$.
They are, nevertheless, `almost surely'
unique; see Section~\ref{sec:equality}.
\end{example}
\begin{example}
Disintegrations in measure-theoretic probability, in $\Kl(\Giry)$, are far more difficult.
Let $\omega\in\Giry(X\times Y)$ be a joint state,
with $\omega_1\in\Giry(X)$ the first marginal.
A channel $c\colon X\to \Giry(Y)$ is a disintegration of $\omega$ if and only if
\[
\omega(A\times B) = \int_A c(x)(B)\,\omega_1(\dd x)
\]
for all $A\in \Sigma_X$ and $B\in \Sigma_Y$. This is the ordinary
notion of \emph{disintegration} (of probability measures), also known
as \emph{regular conditional probability}; see
\textit{e.g.}~\cite{Faden1985,Pollard2002,Panangaden09}. We see that
there is no obvious way to obtain a channel $c$ here, unlike the
discrete case. In fact, a disintegration may not
exist~\cite{Stoyanov2014}. There are, however, a number of results
that guarantee the existence of a disintegration in certain
situations. We will come back to this issue later in the section.
\end{example}
\emph{Bayesian inversion} is a special form of disintegration,
occurring frequently.
We start from a state $\sigma\colon I\to X$ and
a channel $c\colon X\to Y$. We then integrate
them into a joint state on $X$ and $Y$,
and disintegrate it in the other direction, as below.
\[
\biggl(\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node (X) at (0,0.5) {};
\draw (omega) to (X);
\node[scriptstyle] at (0.2,0.35) {$X$};
\end{tikzpicture}}}
\;,\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$c$};
\draw (c) to (0, 0.6);
\draw (c) to (0,-0.6);
\path[scriptstyle]
node at (0.2,0.6) {$Y$}
node at (0.2,-0.6) {$X$};
\end{tikzpicture}}}
\;\biggr)
\quad\xmapsto{\text{integration}}\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$c$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\path[scriptstyle]
node at (-0.7,1.45) {$X$}
node at (0.7,1.45) {$Y$};
\end{tikzpicture}}}
\quad\xmapsto{\text{disintegration}}\quad
\biggl(\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (s) at (0,0) {$\sigma$};
\node[arrow box] (c) at (0,0.45) {$c$};
\draw (s) to (c);
\draw (c) to (0,0.95);
\node[scriptstyle] at (0.2,0.95) {$Y$};
\end{tikzpicture}}}
\;,\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$d$};
\draw (c) to (0, 0.6);
\draw (c) to (0,-0.6);
\path[scriptstyle]
node at (0.2,0.6) {$X$}
node at (0.2,-0.6) {$Y$};
\end{tikzpicture}}}
\;\biggr)
\]
We call the disintegration $d\colon Y\to X$ a \emph{Bayesian inversion}
for $\sigma\colon I\to X$ along $c\colon X\to Y$.
By unfolding the definitions,
a channel $d\colon Y\to X$ is
a Bayesian inversion if and only if
\begin{equation}
\label{eq:bayesian-inversion}
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$c$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,-0.55) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (d) at (-0.5,0.95) {$d$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\node[arrow box] (c) at (0,-0.15) {$c$};
\draw (omega) to (c);
\draw (c) to (copier);
\draw (copier) to[out=165,in=-90] (d);
\draw (copier) to[out=30,in=-90] (Y);
\draw (d) to (X);
\end{tikzpicture}}}
\quad.
\end{equation}
The composite $c\circ\sigma$ is also written as $c_*(\sigma)$.
The operation $\sigma\mapsto c_*(\sigma)$,
called \emph{state transformation},
is used to explain
forward inference in \cite{JacobsZ16}.
\begin{example}
Let $\sigma\in\Dst(X)$
and $c\colon X\to \Dst(Y)$ be a state and a channel in $\Kl(\Dst)$.
Then
a channel $d\colon Y\to \Dst(X)$ is
a Bayesian inversion for $\sigma$ along $c$
if and only if
$c(x)(y)\cdot \sigma(x)=
d(y)(x)\cdot c_*(\sigma)(y)$,
where $c_*(\sigma)(y)=\sum_{x'} c(x')(y)\cdot \sigma(x')$.
In a similar manner to Example~\ref{ex:disintegration},
we can obtain such a $d$ by:
\[
d(y)(x)
\coloneqq
\frac{c(x)(y)\cdot \sigma(x)}{c_*(\sigma)(y)}
=
\frac{c(x)(y)\cdot \sigma(x)}
{\sum_{x'} c(x')(y)\cdot \sigma(x')}
\]
for $y\in Y$ with $c_*(\sigma)(y)\neq 0$.
For $y\in Y$ with $c_*(\sigma)(y)=0$,
we may define $d(y)$ to be an arbitrary state in $\Dst(X)$.
We can recognise the above formula as the Bayes formula:
\[
\Pr(x|y)
=\frac{\Pr(y|x)\cdot \Pr(x)}{\Pr(y)}
=\frac{\Pr(y|x)\cdot \Pr(x)}{\sum_{x'}\Pr(y|x')\cdot \Pr(x')}
\enspace.
\]
\end{example}
\begin{example}
\label{ex:inversion}
Let $\sigma\in\Giry(X)$ and $c\colon X\to \Giry(Y)$
be a state and a channel in $\Kl(\Giry)$.
A channel $d\colon Y\to \Giry(X)$ is a Bayesian inversion if and only if
\[
\int_A c(x)(B)\,\sigma(\dd x)
=
\int_B d(y)(A)\,c_*(\sigma)(\dd y)
\]
for all $A\in\Sigma_X$ and $B\in\Sigma_Y$.
Here $c_*(\sigma)\in\Giry(Y)$
is the measure given by $c_*(\sigma)(B)=\int_X c(x)(B) \,\sigma(\dd x)$.
As we see below, Bayesian inversions are in some sense equivalent to disintegrations,
and thus, they are as difficult as disintegrations.
In particular, a Bayesian inversion need not exist.
In practice, however, the state $\sigma$ and channel $c$ are often given
via density functions.
This setting, so-called (absolutely) continuous probability,
makes it easy to compute a Bayesian inversion.
Suppose that $X$ and $Y$ are subspaces of $\RR$, and that
$\sigma$ and $c$ admit density functions as
\[
\sigma(A) = \int_A f(x) \,\dd x
\qquad\qquad
c(x)(B) = \int_B \ell(x,y) \,\dd y
\]
for measurable functions $f\colon X\to \pRR$ and $\ell\colon X\times
Y\to \pRR$. The conditional probability density $\ell(x,y)$ of $y$
given $x$ is often called the \emph{likelihood} of $x$ given $y$. By
the familiar Bayes formula for densities --- see
\textit{e.g.}~\cite{BernardoS00} --- the conditional density of $x$
given $y$ is:
\begin{equation*}
\label{eq:bayes-density}
k(y,x)
\coloneqq
\frac{\ell(x,y)\cdot f(x)}
{\int_X \ell(x',y)\cdot f(x')\,\dd x'}
\enspace.
\end{equation*}
This $k$ then gives a channel $d\colon Y\to \Giry(X)$ by
\[
d(y)(A) = \int_A k(y,x)\,\dd x
\]
for each $y\in Y$ such that $\int_X \ell(x',y)\cdot f(x')\,\dd x'\neq 0$.
For the other $y$'s we define $d(y)$ to be some fixed state in $\Giry(X)$.
An elementary calculation verifies that $d$ is indeed a Bayesian inversion
for $\sigma$ along $c$.
Later, in Section~\ref{sec:likelihood},
we generalise this calculation into our abstract setting.
\end{example}
Although Bayesian inversions are
a special case of disintegrations,
we can conversely obtain disintegrations from
Bayesian inversions, as in the proposition below.
Therefore, in some sense the two notions are equivalent.
\begin{proposition}
\label{prop:disintegration-from-inversion}
Let $\omega$ be a state on $X\otimes Y$.
Let $d\colon X\to
X\otimes Y$ be a Bayesian inversion for $\omega$ along the
first projection $\pi_1\colon X\otimes Y\to X$ on the left below.
\[
\pi_1 \,=\;\;
\begin{ctikzpicture}[font=\small]
\node[discarder] (d) at (0,0.4) {};
\draw (0,0) to (d);
\draw (-0.35,0) to +(0,0.9);
\path[scriptstyle]
node at (-0.5,0.15) {$X$}
node at (0.15,0.15) {$Y$};
\end{ctikzpicture}
\qquad\qquad\qquad\qquad\qquad
\pi_2\circ d
\,=\;\;
\begin{ctikzpicture}[font=\small]
\node[discarder] (dis) at (-0.2,0.4) {};
\node[arrow box] (d) at (0,0) {\;\;$d$\;\;};
\draw (d.north) ++ (-0.2,0) to (dis);
\draw (d.north) ++ (0.2,0) to (0.2,0.7);
\draw (d.south) to (0,-0.5);
\path[scriptstyle]
node at (0.15,-0.45) {$X$}
node at (0.35,0.65) {$Y$};
\end{ctikzpicture}
\]
Then the composite
$\pi_2\circ d\colon X\to Y$
shown on the right above is a disintegration of $\omega$.
\end{proposition}
\begin{myproof}
We prove that the first equation in \eqref{eqn:disintegrations} holds for $c_1=\pi_2\circ d$, as follows.
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (di1) at (0.25,0.15) {};
\node[discarder] (di2) at (-0.05,1.5) {};
\node[state] (s) at (0,0) {\;$\omega$\;};
\node[copier] (c) at (-0.25,0.5) {};
\node[arrow box] (d) at (0.15,1.1) {\;\;$d$\;\;};
\draw (s) ++(-0.25,0) to (c);
\draw (s) ++(0.25,0) to (di1);
\draw (c) to[out=15,in=-90] (d.south);
\draw (c) to[out=135,in=-90] (-0.65,1.8);
\draw (d.north) ++(-0.2,0) to (di2);
\draw (d.north) ++(0.2,0) to (0.35,1.8);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (di1) at (0.25,0.15) {};
\node[discarder] (di2) at (-0.05,1.6) {};
\node[state] (s) at (0,0) {\;$\omega$\;};
\node[copier] (c) at (-0.25,0.3) {};
\node[arrow box] (d) at (0.15,1.2) {\;\;$d$\;\;};
\draw (s) ++(-0.25,0) to (c);
\draw (s) ++(0.25,0) to (di1);
\draw (c) to[out=150,in=-90] (-0.4,0.5)
to[out=90,in=-90] (d.south);
\draw (c) to[out=30,in=-90] (-0.1,0.5)
to[out=90,in=-90] (-0.6,0.95)
to (-0.6,1.9);
\draw (d.north) ++(-0.2,0) to (di2);
\draw (d.north) ++(0.2,0) to (0.35,1.9);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (di1) at (0.25,0.15) {};
\node[discarder] (di2) at (-0.9,1.35) {};
\node[state] (s) at (0,0) {\;$\omega$\;};
\node[copier] (c) at (-0.25,0.35) {};
\node[arrow box] (d) at (-0.7,0.9) {\;\;$d$\;\;};
\draw (s) ++(-0.25,0) to (c);
\draw (s) ++(0.25,0) to (di1);
\draw (c) to[out=165,in=-90] (d.south);
\draw (c) to[out=30,in=-90] (0.1,0.7)
to (0.1,1.35)
to[out=90,in=-90] (-0.5,1.85);
\draw (d.north) ++(-0.2,0) to (di2);
\draw (d.north) ++(0.2,0) to (-0.5,1.35)
to[out=90,in=-90] (0.1,1.85);
\end{tikzpicture}}}
\;\;\overset{*}{=}\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\coordinate (di1) at (-0.75,1.1);
\coordinate (di2) at (0.75,0.75);
\node[discarder] at (di2) {};
\node[discarder] at (di1) {};
\node[state] (s) at (0,0) {\;$\omega$\;};
\node[copier] (c1) at (-0.25,0.25) {};
\node[copier] (c2) at (0.25,0.25) {};
\draw (s) ++(-0.25,0) to (c1);
\draw (s) ++(0.25,0) to (c2);
\draw (c1) to[out=150,in=-90] (-0.75,0.75)
to (di1);
\draw (c2) to[out=30,in=-90] (di2);
\draw (c1) to[out=30,in=-90] (0.45,0.75)
to[out=90,in=-90] (-0.45,1.6);
\draw (c2) to[out=150,in=-90] (-0.45,0.75)
to[out=90,in=-90] (0.45,1.6);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (s) at (0,0) {\;$\omega$\;};
\draw (s) ++(-0.25,0)
to[out=90,in=-90] (0.25,0.7)
to[out=90,in=-90] (-0.25,1.4);
\draw (s) ++(0.25,0)
to[out=90,in=-90] (-0.25,0.7)
to[out=90,in=-90] (0.25,1.4);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (s) at (0,0) {\;$\omega$\;};
\draw (s) ++(-0.25,0) to (-0.25,0.5);
\draw (s) ++(0.25,0) to (0.25,0.5);
\end{tikzpicture}}}
\]
For the marked equality $\overset{*}{=}$
we used the equation \eqref{eq:bayesian-inversion}
for the Bayesian inversion $d$.
\end{myproof}
We say that
an affine CD-category $\catC$ \emph{admits disintegration}
if for every bipartite state $\omega\colon I\to X\otimes Y$
there exist a disintegration $c_1\colon X\to Y$ of $\omega$.
Note that in such categories there also exists
a disintegration $c_2\colon Y\to X$ of $\omega$ in the other direction,
since it can be obtained as a disintegration of the following state:
\[
\begin{ctikzpicture}[font=\small]
\node[state] (s) at (0,0) {\;$\omega$\;};
\draw (s) ++(-0.25,0)
to[out=90,in=-90] (0.25,0.5);
\draw (s) ++(0.25,0)
to[out=90,in=-90] (-0.25,0.5);
\path[scriptstyle]
node at (-0.4,0.5) {$Y$}
node at (0.4,0.5) {$X$};
\end{ctikzpicture}
\quad.
\]
By Proposition~\ref{prop:disintegration-from-inversion},
admitting disintegration is equivalent to admitting Bayesian inversion.
In Example~\ref{ex:disintegration},
we have seen that $\Kl(\Dst)$ admits disintegration,
but that in measure-theoretic probability, in $\Kl(\Giry)$,
disintegrations may not exist.
There are however a number of results that guarantee
the existence of disintegrations in specific situations,
see \textit{e.g.}~\cite{Pachl1978,Faden1985}.
We here invoke one of these results
and show that
there is a subcategory of $\Kl(\Giry)$ that admits disintegration.
A measurable space is called a \emph{standard
Borel space} if it is measurably isomorphic to a Polish space with its
Borel $\sigma$-algebra, or equivalently, if it is measurably isomorphic to
a Borel subspace of $\RR$.
Then the following theorem is standard,
see \textit{e.g.}~\cite[\S5.2]{Pollard2002}
or~\cite[\S5]{Faden1985}.
\begin{theorem}
\label{thm:disintegration-stborel}
Let $X$ be any measurable space and $Y$ be a standard
Borel space.
Then for any state (\textit{i.e.}\ a probability measure)
$\omega\in\Giry(X\times Y)$ in $\Kl(\Giry)$,
there exists a disintegration $c_1\colon X\to \Giry(Y)$ of $\omega$.
\qed
\end{theorem}
Let $\pKrnsb$ be the full subcategory of $\Kl(\Giry)$
consisting of standard Borel spaces as objects.
Clearly $\pKrnsb$ contains the singleton
measurable space $1$,
which is the tensor unit of $\Kl(\Giry)$.
We claim that the product
(in $\Meas$, hence the tensor product in $\Kl(\Giry)$)
of two standard Borel spaces
is again standard Borel.
Let $(X,\Sigma_X)$ and $(Y,\Sigma_Y)$
be standard Borel spaces.
We fix Polish ($=$ separable completely metrisable)
topologies on $X$ and $Y$ that induce
the $\sigma$-algebras $\Sigma_X$
and $\Sigma_Y$, respectively.
Then the product $X\times Y$, as topological spaces,
is Polish \cite[Lemma~1.17]{Doberkat2007}.
The Borel $\sigma$-algebra of the Polish space $X\times Y$
coincides with
the $\sigma$-algebra on the product $X\times Y$
in $\Meas$ \cite[Proposition~2.8]{Panangaden09}.
Hence $X\times Y$ is standard Borel.
Therefore
the subcategory $\pKrnsb\hookrightarrow \Kl(\Giry)$
is closed under the monoidal structure of $\Kl(\Giry)$,
so that $\pKrnsb$ is an affine CD-category.
Then the previous theorem immediately shows:
\begin{corollary}
The category $\pKrnsb$ admits disintegration.
\qed
\end{corollary}
We note that $\pKrnsb$ can also be seen as the Kleisli category
of the Giry monad restricted on the category of standard Borel spaces,
because $\Giry(X)$ is standard Borel whenever $X$ is standard Borel.
To see this, let $(X,\Sigma_X)$ be
a standard Borel space.
If we fix a Polish topology on $X$ that
induces $\Sigma_X$,
then $\Giry(X)$ also forms a Polish space
with the \emph{topology of weak convergence},
see \cite{Giry1982} or \cite[\S1.5.2]{Doberkat2007}.
The $\sigma$-algebra on $\Giry(X)$,
defined in Example~\ref{ex:KlG},
coincides with
the Borel $\sigma$-algebra
with respect to the Polish topology
\cite[Proposition~1.80]{Doberkat2007}.
Therefore $\Giry(X)$ is standard Borel.
Since there are various `existence' theorems like
Theorem~\ref{thm:disintegration-stborel}, there may be other
subcategories of $\Kl(\Giry)$ that admit disintegration. A likely
candidate is the category of perfect probabilistic mappings
in~\cite{CulbertsonS2014}. We do not go into this question here,
since $\pKrnsb$ suffices for the present paper.
\section{Example: naive Bayesian classifiers via inversion}
\label{sec:classifier}\tikzextname{s_classifier}
Bayesian classification is a well-known technique in machine learning
that produces a distribution over data classifications, given certain
sample data. The distribution describes the probability, for each data
(classification) category, that the sample data is in that
category. Here we consider an example of `naive' Bayesian
classification, where the features are assumed to be independent. We
consider a standard classification example from the literature which
forms an ideal setting to illustrate the use of both disintegration
and Bayesian inversion. Disintegration is used to extract channels
from a given table, and subsequently Bayesian inversion is applied to
(the tuple of) these channels to obtain the actual classification.
The use of channels and disintegration/inversion in this
classification setting is new, as far as we know.
For the description of the relevant operations in this example we use
notation for marginalisation and disintegration that we borrowed from
the \EfProb library~\cite{ChoJ17}. There are many ways to marginalise
an $n$-partite state, namely one for each subset of the wires $\{1, 2,
\ldots, n\}$. Such a subset can be described as a \emph{mask},
consisting of a list of $n$ zero's or one's, where a zero at position
$i$ means that the $i$-th wire/component is marginalised out, and a
one at position $i$ means that it remains. Such a mask $M = [b_{1},
\ldots, b_{n}]$ with $b_{i}\in\{0,1\}$ is used as a post-fix
selection operation in $\marg{\omega}{M}$ on an $n$-partite state
$\omega$. An example explains it all:
\[ \mbox{if}\qquad \omega\; = \;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{3em}};
\coordinate (X1) at (-1.0,0.4);
\coordinate (X2) at (-0.5,0.4) {};
\coordinate (X3) at (0.0,0.4) {};
\coordinate (X4) at (0.5,0.4) {};
\coordinate (X5) at (1.0,0.4) {};
\draw (omega) ++(-1.0, 0) to (X1);
\draw (omega) ++(-0.5, 0) to (X2);
\draw (omega) ++(0.0, 0) to (X3);
\draw (omega) ++(0.5, 0) to (X4);
\draw (omega) ++(1.0, 0) to (X5);
\end{tikzpicture}}}
\qquad\mbox{then}\qquad
\marg{\omega}{[1,0,1,0,0]} \; = \;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{3em}};
\coordinate (X1) at (-1.0,0.4);
\node [discarder] (ground1) at (-0.5,0.2) {};
\coordinate (X2) at (0.0,0.4) {};
\node [discarder] (ground2) at (0.5,0.2) {};
\node [discarder] (ground3) at (1.0,0.2) {};
\draw (omega) ++(-1.0, 0) to (X1);
\draw (omega) ++(-0.5, 0) to (ground1);
\draw (omega) ++(0.0, 0) to (X2);
\draw (omega) ++(0.5, 0) to (ground2);
\draw (omega) ++(1.0, 0) to (ground3);
\end{tikzpicture}}} \]
\noindent In a similar way one can disintegrate an $n$-partite state
in $2^n$ may ways, where a mask of length $n$ is now used to describe
which wires are used as input to the extracted channel and which ones
as output. We write $\disint{\omega}{M}$ for such a disintegration,
where $M$ is a mask, as above. A systematic description will be given
in Section~\ref{sec:conditionalindependence} below.
In practice it is often useful to be able to marginalise first, and
disintegrate next. The general description in $n$-ary form is a bit
complicated, so we use an example for $n=5$. We shall label the wires
with $x_i$, as on the left below. We seek the conditional probability
written conventionally as $c = \omega[x_{1}, x_{4} \mid x_{2}, x_{5}]$
on the right below.
\[ \vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\coordinate (X1) at (-1.0,0.4);
\coordinate (X2) at (-0.5,0.4) {};
\coordinate (X3) at (0.0,0.4) {};
\coordinate (X4) at (0.5,0.4) {};
\coordinate (X5) at (1.0,0.4) {};
\node at (-1.0,0.6) {$x_{1}$};
\node at (-0.5,0.6) {$x_{2}$};
\node at (0.0,0.6) {$x_{3}$};
\node at (0.5,0.6) {$x_{4}$};
\node at (1.0,0.6) {$x_{5}$};
\draw (omega) -- (-1.0, 0) to (X1);
\draw (omega) ++(-0.5, 0) to (X2);
\draw (omega) ++(0.0, 0) to (X3);
\draw (omega) ++(0.5, 0) to (X4);
\draw (omega) ++(1.0, 0) to (X5);
\end{tikzpicture}}}
\hspace*{10em}
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {\hspace*{1em}$c$\hspace*{1em}};
\coordinate (X1) at (-0.3,0.6);
\coordinate (X4) at (0.3,0.6) {};
\coordinate (X2) at (-0.3,-0.6) {};
\coordinate (X5) at (0.3,-0.6) {};
\draw (c.north)++(-0.3,0) to (X1);
\draw (c.north)++(0.3,0) to (X4);
\draw (c.south)++(-0.3,0) to (X2);
\draw (c.south)++(0.3,0) to (X5);
\node at (-0.3,0.8) {$x_{1}$};
\node at (0.3,0.8) {$x_{4}$};
\node at (-0.3,-0.8) {$x_{2}$};
\node at (0.3,-0.8) {$x_{5}$};
\end{tikzpicture}}}
\]
\noindent This channel $c$ must satisfy:
\[ \vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\coordinate (X1) at (-1.0,0.4);
\coordinate (X2) at (-0.5,0.4) {};
\node [discarder] (ground) at (0.0,0.2) {};
\coordinate (X4) at (0.5,0.4) {};
\coordinate (X5) at (1.0,0.4) {};
\draw (omega) ++(-1.0, 0) to (X1);
\draw (omega) ++(-0.5, 0) to (X2);
\draw (omega) ++(0.0, 0) to (ground);
\draw (omega) ++(0.5, 0) to (X4);
\draw (omega) ++(1.0, 0) to (X5);
\end{tikzpicture}}}
\quad = \quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\coordinate (X1) at (-1.0,2.0);
\coordinate (X2) at (-0.5,2.0) {};
\coordinate (X4) at (0.5,2.0) {};
\coordinate (X5) at (1.0,2.0) {};
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\node [discarder] (ground1) at (-1.0,0.2) {};
\node[copier] (c2) at (-0.5,0.4) {};
\node [discarder] (ground3) at (0.0,0.2) {};
\node [discarder] (ground4) at (0.5,0.2) {};
\node[copier] (c5) at (1.0,0.4) {};
\node[arrow box] (c) at (0.25,1.2) {\hspace*{1em}$c$\hspace*{1em}};
\draw (omega) ++(-1.0, 0) to (ground1);
\draw (omega) ++(-0.5, 0) to (c2);
\draw (omega) ++(0.0, 0) to (ground3);
\draw (omega) ++(0.5, 0) to (ground4);
\draw (omega) ++(1.0, 0) to (c5);
\draw (c2) to[out=45,in=-90] (c.-135);
\draw (c2) to[out=135,in=-90] (X2);
\draw (c5) to[out=135,in=-90] (c.-45);
\draw (c5) to[out=45,in=-90] (X5);
\draw (c.135) to[out=90,in=-90] (X1);
\draw (c.47) to (X4);
\end{tikzpicture}}}
\]
\noindent This picture shows how to obtain the channel $c$ from
$\omega$: we first marginalise to restrict to the relevant wires
$x_{1}, x_{2}, x_{4}, x_{5}$. This is written as
$\marg{\omega}{[1,1,0,1,1]}$. Subsequently we disintegrate with
$x_{1},x_{4}$ as output and $x_{2},x_{5}$ as input. Hence:
\[ \begin{array}{rcl}
c
& \coloneqq &
\disint{\marg{\omega}{[1,1,0,1,1]}}{[0,1,0,1]}
\\
& \eqqcolon &
\extract{\omega}{[1,0,0,1,0]}{[0,1,0,0,1]}
\quad \mbox{as we shall write in the sequel.}
\end{array} \]
\noindent We see that the latter post-fix $\big[[1,0,0,1,0] \,\big|\,
[0,1,0,0,1]\big]$ is a `variable free' version of the traditional
notation $[x_{1}, x_{4} \mid x_{2}, x_{5}]$, selecting the relevant
positions.
We have now prepared the ground and can turn to the classification
example that we announced. It involves the classification of
`playing' (yes or no) for certain weather data, used
in~\cite{WittenFH11}. We shall first go through the discrete example
in some detail. The relevant data are in the table in
Figure~\ref{fig:discreteplay}. The question is: given this table,
what can be said about the probability of playing if the outlook is
\emph{Sunny}, the temperature is \emph{Cold}, the humidity is
\emph{High} and it is Windy?
\begin{figure}
\begin{center}
{\setlength\tabcolsep{2em}\renewcommand{\arraystretch}{0.9}
\begin{tabular}{c|c|c|c|c}
\textbf{Outlook} & \textbf{Temperature} & \textbf{Humidity} &
\textbf{Windy} & \textbf{Play}
\\
\hline\hline
Sunny & hot & high & false & no
\\
Sunny & hot & high & true & no
\\
Overcast & hot & high & false & yes
\\
Rainy & mild & high & false & yes
\\
Rainy & cool & normal & false & yes
\\
Rainy & cool & normal & true & no
\\
Overcast & cool & normal & true & yes
\\
Sunny & mild & high & false & no
\\
Sunny & cool & normal & false & yes
\\
Rainy & mild & normal & false & yes
\\
Sunny & mild & normal & true & yes
\\
Overcast & mild & high & true & yes
\\
Overcast & hot & normal & false & yes
\\
Rainy & mild & high & true & no
\end{tabular}}
\end{center}
\caption{Weather and play data, copied from~\cite{WittenFH11}.}
\label{fig:discreteplay}
\end{figure}
Our plan is to first organise these table data into four channels
$d_{O}, d_{T}, d_{H}, d_{W}$ in a network of the form:
\begin{equation}
\label{diag:discreteplay}
\vcenter{\xymatrix@C-1pc{
\ovalbox{\strut Outlook} & & \ovalbox{\strut Temperature} & &
\ovalbox{\strut Humidity} & & \ovalbox{\strut Windy}
\\
& & & \ovalbox{\strut Play}\ar@/^2ex/[ulll]^-{d_{O}}\ar@/_1ex/[ur]^-{d_{H}}\ar@/_2ex/[urrr]_-{d_{W}}\ar@{-<}@/^1ex/[ul]_-{d_{T}} & & &
}}
\end{equation}
\noindent We start by extracting the underlying sets for
for the categories in the table in Figure~\ref{fig:discreteplay}. We
choose abbreviations for the entries in each of the categories.
\[ \begin{array}{rclcrclcrclcrclcrcl}
O
& = &
\{s, o, r\}
& \quad &
W
& = &
\{t, f\}
& \quad &
T
& = &
\{h, m, c\}
& \quad &
P
& = &
\{y, n\}
& \quad &
H
& = &
\{h, n\}.
\end{array} \]
\noindent These sets are combined into a single product domain:
\[ \begin{array}{rcl}
D
& = &
O \times T \times H \times W \times P.
\end{array} \]
\noindent It combines the five columns in
Figure~\ref{fig:discreteplay}. The table itself in the figure is
represented as a uniform distribution $\tau \in\Dst(D)$. This
distribution has 14 entries --- like in the table --- and looks as
follows.
\[ \begin{array}{rcl}
\tau
& = &
\frac{1}{14}\ket{s,h,h,f,n} + \frac{1}{14}\ket{s,h,h,t,n} + \cdots +
\frac{1}{14}\ket{r,m,h,t,n}.
\end{array} \]
We extract the four channels in Diagram~\eqref{diag:discreteplay} via
appropriate disintegrations, from the Play column to the Outlook /
Temperature / Humidity / Windy columns.
\[ \begin{array}{rclcrcl}
d_{O}
& = &
\extract{\tau}{[1,0,0,0,0]}{[0,0,0,0,1]}
& \hspace*{3em} &
d_{T}
& = &
\extract{\tau}{[0,1,0,0,0]}{[0,0,0,0,1]}
\\
d_{H}
& = &
\extract{\tau}{[0,0,1,0,0]}{[0,0,0,0,1]}
& &
d_{W}
& = &
\extract{\tau}{[0,0,0,1,0]}{[0,0,0,0,1]}.
\end{array} \]
\noindent Thus, as described in the beginning of this section, the
`outlook' channel $d_{O} \colon P \rightarrow \Dst(O)$ is extracted by
first marginalising the table $\tau$ to the relevant (first and last)
wires, and then disintegrating. Explicitly, $d_{O}$ is
$\disint{\marg{\tau}{[1,0,0,0,1]}}{[0,1]}$ and satisfies:
\[ \vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\coordinate (X1) at (-1.0,0.4) {};
\node [discarder] (ground2) at (-0.5,0.2) {};
\node [discarder] (ground3) at (0.0,0.2) {};
\node [discarder] (ground4) at (0.5,0.2) {};
\coordinate (X5) at (1.0,0.4) {};
\draw (omega) ++(-1.0, 0) to (X1);
\draw (omega) ++(-0.5, 0) to (ground2);
\draw (omega) ++(0.0, 0) to (ground3);
\draw (omega) ++(0.5, 0) to (ground4);
\draw (omega) ++(1.0, 0) to (X5);
\path[scriptstyle]
node at (-1.2,0.45) {$O$}
node at (1.2,0.45) {$P$};
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\pi$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (-0.5,0.95) {$d_O$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (c);
\draw (copier) to[out=15,in=-90] (Y);
\draw (c) to (X);
\path[scriptstyle]
node at (-0.7,1.55) {$O$}
node at (0.7,1.55) {$P$};
\end{tikzpicture}}}
\qquad\mbox{where}\qquad
\pi
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\node [discarder] (ground1) at (-1.0,0.2) {};
\node [discarder] (ground2) at (-0.5,0.2) {};
\node [discarder] (ground3) at (0.0,0.2) {};
\node [discarder] (ground4) at (0.5,0.2) {};
\coordinate (X5) at (1.0,0.4) {};
\draw (omega) ++(-1.0, 0) to (ground1);
\draw (omega) ++(-0.5, 0) to (ground2);
\draw (omega) ++(0.0, 0) to (ground3);
\draw (omega) ++(0.5, 0) to (ground4);
\draw (omega) ++(1.0, 0) to (X5);
\path[scriptstyle]
node at (1.2,0.45) {$P$};
\end{tikzpicture}}}
\]
\noindent In a next step we combine these four channels into a single channel
$d\colon P\rightarrow O\times T\times H\times W$ via tupling:
\[ d
\quad\coloneqq\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (copier) at (0,0.0) {};
\node[arrow box] (o) at (-1.2,0.6) {$d_O$};
\node[arrow box] (t) at (-0.4,0.6) {$d_T$};
\node[arrow box] (h) at (0.4,0.6) {$d_H$};
\node[arrow box] (w) at (1.2,0.6) {$d_W$};
\draw (copier) to (0.0,-0.3);
\draw (copier) to[out=165,in=-90] (o);
\draw (copier) to[out=115,in=-90] (t);
\draw (copier) to[out=65,in=-90] (h);
\draw (copier) to[out=15,in=-90] (w);
\draw (o) to (-1.2,1.1);
\draw (t) to (-0.4,1.1);
\draw (h) to (0.4,1.1);
\draw (w) to (1.2,1.1);
\end{tikzpicture}}} \]
\noindent The answer that we are looking for will be obtained by
Bayesian inversion of this channel $d$ wrt.\ the above fifth marginal
Play state $\pi = \marg{\tau}{[0,0,0,0,1]} = \frac{9}{14}\ket{y} +
\frac{5}{14}\ket{n} \in \Dst(P)$. We write this inversion as a channel $e
\colon O\times T\times H\times W \rightarrow P$. It satisfies, by
construction, according to the pattern
in~\eqref{eq:bayesian-inversion}:
\[ \vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (1.2,-1.0) {$\pi$};
\node[copier] (copier1) at (1.2,-0.8) {};
\node[copier] (copier4) at (0.0,-0.2) {};
\node[arrow box] (o) at (-1.2,0.6) {$d_O$};
\node[arrow box] (t) at (-0.4,0.6) {$d_T$};
\node[arrow box] (h) at (0.4,0.6) {$d_H$};
\node[arrow box] (w) at (1.2,0.6) {$d_W$};
\draw (omega) to (copier1);
\draw (copier1) to[out=150,in=-90] (copier4);
\draw (copier1) to[out=15,in=-90] (2.0,1.1);
\draw (copier4) to[out=165,in=-90] (o);
\draw (copier4) to[out=115,in=-90] (t);
\draw (copier4) to[out=65,in=-90] (h);
\draw (copier4) to[out=15,in=-90] (w);
\draw (o) to (-1.2,1.1);
\draw (t) to (-0.4,1.1);
\draw (h) to (0.4,1.1);
\draw (w) to (1.2,1.1);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,-0.2) {$\pi$};
\node[copier] (copier) at (0,0.0) {};
\node[arrow box] (o) at (-1.2,0.6) {$d_O$};
\node[arrow box] (t) at (-0.4,0.6) {$d_T$};
\node[arrow box] (h) at (0.4,0.6) {$d_H$};
\node[arrow box] (w) at (1.2,0.6) {$d_W$};
\node[copier] (copier1) at ([yshiftu=0.5]o) {};
\node[copier] (copier2) at ([yshiftu=0.5]t) {};
\node[copier] (copier3) at ([yshiftu=0.5]h) {};
\node[copier] (copier4) at ([yshiftu=0.5]w) {};
\node[arrow box] (e) at (2.0,2.3) {\hspace*{2.2em}$e$\hspace*{2.2em}};
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90] (o);
\draw (copier) to[out=115,in=-90] (t);
\draw (copier) to[out=65,in=-90] (h);
\draw (copier) to[out=15,in=-90] (w);
\draw (o) to (copier1);
\draw (t) to (copier2);
\draw (h) to (copier3);
\draw (w) to (copier4);
\draw (copier1) to[out=165,in=-90] (-1.5,2.8);
\draw (copier1) to[out=65,in=-90] (e.-160);
\draw (copier2) to[out=165,in=-90] (-0.8,2.8);
\draw (copier2) to[out=45,in=-90] (e.-135);
\draw (copier3) to[out=165,in=-90] (-0.1,2.8);
\draw (copier3) to[out=25,in=-90] (e.-45);
\draw (copier4) to[out=165,in=-90] (0.6,2.8);
\draw (copier4) to[out=5,in=-90] (e.-20);
\draw (e) to ([yshiftu=0.5]e);
\end{tikzpicture}}}
\]
\noindent We can finally answer the original classification
question. The assumptions --- \emph{Sunny} outlook,
\emph{Cold} temperature, \emph{High} humidity, \emph{true} windiness
--- are used as input to the inversion channel $e$. This yields the
probability of play that we are looking for:
\[ \begin{array}{rcl}
e(s,c,H,t)
& = &
0.205\ket{y} + 0.795\ket{n}.
\end{array} \]
\noindent The resulting classification probability\footnote{This
outcome has been calculated with the tool \EfProb~\cite{ChoJ17}
that can do both disintegration and inversion.} of $0.205$ coincides
with the probability of $20.5\%$ that is computed in~\cite{WittenFH11}
--- without the above channel-based approach.
One could complain that our approach is `too' abstract, since it
remains implicit what these extracted channels do. We elaborate the
outlook channel $d_{O} \colon P \rightarrow O$. For the two elements
in $P = \{y,n\}$ we have:
\[ \begin{array}{rclcrcl}
d_{O}(y)
& = &
\frac{2}{9}\ket{s} + \frac{4}{9}\ket{o} + \frac{3}{9}\ket{r}
& \qquad\qquad &
d_{O}(n)
& = &
\frac{3}{5}\ket{s} + 0\ket{o} + \frac{2}{5}\ket{r}.
\end{array} \]
\noindent These outcomes arise from the general
formula~\eqref{eqn:discrete:disintegration}. But we can also
understand them at a more concrete level: for the first distribution
$d_{O}(y)$ we need to concentrate on the 9 lines in
Figure~\ref{fig:discreteplay} for which Play is \emph{yes}; in these
lines, in the first Outlook column, 2 out of 9 entries are
\emph{Sunny}, 4 out of 9 are \emph{Overcast}, and 3 out of 9 are
\emph{Rainy}. This corresponds to the above first distribution
$d_{O}(y)$. Similarly, the second distribution $d_{O}(n)$ captures the
Outlook for the 5 lines where Play is \emph{no}: 3 out of 5 are
\emph{Sunny} and 2 out of 5 are \emph{Rainy}.
\section{Almost equality of channels}\label{sec:equality}
\tikzextname{s_eq}
This section explains how the standard notion of
`equal up to negligible sets' or
`equal almost everywhere' (with respect to a measure)
can be expressed abstractly using string diagrams.
Via this equality relation Bayesian inversion can be characterised
very neatly, following~\cite{ClercDDG2017}.
We consider an affine CD-category,
continuing in the setting of Section~\ref{sec:disintegration}.
\begin{definition}
\label{def:almost-equal}
Let $c,d\colon X\to Y$ be two parallel channels, and $\sigma\colon
I\to X$ be a state on their domain. We say that $c$
is \emph{$\sigma$-almost equal} to $d$, written as $c\equpto[\sigma]d$ if
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (-0.5,0.95) {$c$};
\coordinate (X) at (0.5,1.5);
\coordinate (Y) at (-0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=30,in=-90] (X);
\draw (copier) to[out=165,in=-90] (c);
\draw (c) to (Y);
\end{ctikzpicture}
\quad=\quad
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (-0.5,0.95) {$d$};
\coordinate (X) at (0.5,1.5);
\coordinate (Y) at (-0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=30,in=-90] (X);
\draw (copier) to[out=165,in=-90] (c);
\draw (c) to (Y);
\end{ctikzpicture}
\quad\enspace.
\]
It is obvious that $\equpto[\sigma]$ is an equivalence relation
on channels of type $X\to Y$.
When $S$ is a set of arrows of type $X\to Y$,
we write $S/\sigma$ for the quotient $S/\!\equpto[\sigma]$.
\end{definition}
\noindent
To put it more intuitively,
we have $c\equpto[\sigma]d$
iff $c$ and $d$ can be identified
whenever the input wires are connected to $\sigma$,
possibly through copiers.
For instance, using the associativity and commutativity of copiers,
by $c\equpto[\sigma]d$ we may reason as:
\[
\begin{ctikzpicture}[font=\small]
\node[state] (s) at (-0.5,-0.2) {$\sigma$};
\node[copier] (c2) at (-0.5,0) {};
\node[copier] (c1) at (-0.9,0.35) {};
\node[arrow box] (a) at (-0.6,0.9) {$c$};
\draw (c2) to[out=165,in=-90] (c1);
\draw (c2) to[out=15,in=-90] (0,1.4);
\draw (c1) to[out=15,in=-90] (a);
\draw (c1) to[out=165,in=-90] (-1.3,1.4);
\draw (c2) to (s);
\draw (a) to (-0.6,1.4);
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (s) at (-0.5,-0.1) {$\sigma$};
\node[copier] (c2) at (-0.5,0.1) {};
\node[copier] (c1) at (-0.2,0.6) {};
\node[arrow box] (a) at (-1,0.6) {$c$};
\draw (c2) to[out=15,in=-90] (c1);
\draw (c2) to[out=165,in=-90] (a)
(a) to (-1,0.9)
to[out=90,in=-90] (-0.5,1.5);
\draw (c1) to[out=45,in=-90] (0.1,1.5);
\draw (c1) to[out=165,in=-90] (-0.5,0.9)
to[out=90,in=-90] (-1,1.5);
\draw (c2) to (s);
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (s) at (-0.5,-0.1) {$\sigma$};
\node[copier] (c2) at (-0.5,0.1) {};
\node[copier] (c1) at (-0.2,0.6) {};
\node[arrow box] (a) at (-1,0.6) {$d$};
\draw (c2) to[out=15,in=-90] (c1);
\draw (c2) to[out=165,in=-90] (a)
(a) to (-1,0.9)
to[out=90,in=-90] (-0.5,1.5);
\draw (c1) to[out=45,in=-90] (0.1,1.5);
\draw (c1) to[out=165,in=-90] (-0.5,0.9)
to[out=90,in=-90] (-1,1.5);
\draw (c2) to (s);
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (s) at (-0.5,-0.2) {$\sigma$};
\node[copier] (c2) at (-0.5,0) {};
\node[copier] (c1) at (-0.9,0.35) {};
\node[arrow box] (a) at (-0.6,0.9) {$d$};
\draw (c2) to[out=165,in=-90] (c1);
\draw (c2) to[out=15,in=-90] (0,1.4);
\draw (c1) to[out=15,in=-90] (a);
\draw (c1) to[out=165,in=-90] (-1.3,1.4);
\draw (c2) to (s);
\draw (a) to (-0.6,1.4);
\end{ctikzpicture}
\quad.
\]
In particular, $c\equpto[\sigma]d$ if and only if
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$c$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\end{ctikzpicture}
\quad=\quad
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$d$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\end{ctikzpicture}
\quad.
\]
Now the following is an obvious consequence from the definition.
\begin{proposition}
If both $c,d\colon X\to Y$ are disintegrations
of a joint state $\omega\colon I\to X\otimes Y$,
then $c\equpto[\omega_1] d$,
where $\omega_1\colon I\to X$ is the first marginal of $\omega$.
\qed
\end{proposition}
For channels $f,g\colon X\to\Dst(Y)$
and a state $\sigma\in\Dst(X)$ in $\Kl(\Dst)$,
it is easy to see that
$f\equpto[\sigma] g$ if and only if
$f(x)(y)\cdot \sigma(x)=g(x)(y)\cdot \sigma(x)$ for all $x\in X$ and $y\in Y$
if and only if
$f(x)=g(x)$ for any $x\in X$ with $\sigma(x)\ne 0$.
Almost equality in $\Kl(\Giry)$
is less trivial but characterised in an expected way.
\begin{proposition}
\label{prop:equality-up-to-giry}
Let $f,g\colon X\to \Giry (Y)$ be channels
and $\mu\in\Giry(X)$ a state in $\Kl(\Giry)$.
Then $f\equpto[\mu] g$ if and only if
for any $B\in \Sigma_Y$,
$f(-)(B)=g(-)(B)$ $\mu$-almost everywhere.
\end{proposition}
\begin{myproof}
By expanding the definition,
$f\equpto[\mu] g$ if and only if
\[
\int_A f(x)(B)\,\mu(\dd x)=\int_A g(x)(B)\,\mu(\dd x)
\]
for all $A\in \Sigma_X$ and $B\in \Sigma_Y$.
This is equivalent to
$f(-)(B)=g(-)(B)$ $\mu$-almost everywhere
for all $B\in\Sigma_Y$, see~\cite[131H]{FremlinAll}.
\end{myproof}
Almost-everywhere equality of probability kernels
$f,g\colon X\to \Giry (Y)$ is often formulated
by the stronger condition that $f=g$ $\mu$-almost everywhere.
The next proposition shows that the stronger variant
is equivalent under a reasonable assumption
(any standard Borel space is countably generated, for example).
\begin{proposition}
In the setting of the previous proposition,
additionally assume that
the measurable space $Y$ is countably generated.
Then $f\equpto[\mu] g$ if and only if
$f=g$ $\mu$-almost everywhere.
\end{proposition}
\begin{proof}
Let the $\sigma$-algebra $\Sigma_Y$ on $Y$ be generated by
a countable family $(B_n)_n$. We may assume that $(B_n)_n$
is a $\pi$-system, \textit{i.e.}\ a family closed under binary intersections.
Let $A_n=\set{x\in X|f(x)(B_n)=g(x)(B_n)}$, and $A=\bigcap_n A_n$.
Each $A_n$ is $\mu$-conegligible, and thus $A$ is $\mu$-conegligible.
For each $x\in A$, we have $f(x)(B_n)=g(x)(B_n)$ for all $n$.
By application of the Dynkin $\pi$-$\lambda$ theorem,
it follows that $f(x)=g(x)$.
Therefore $f=g$ $\mu$-almost everywhere.
\end{proof}
We can now present a fundamental result
from~\cite[\S3.3]{ClercDDG2017} in our abstract setting.
Let $\catC$ be an affine CD-category
and $\commacat{I}{\catC}$ be the comma (coslice) category.
Objects in
$\commacat{I}{\catC}$ are states in $\catC$, formally pairs
$(X,\sigma)$ of objects $X\in\catC$ and states $\sigma\colon I\to X$.
Arrows from $(X,\sigma)$ to $(Y,\tau)$ are \emph{state-preserving}
channels, namely
$c\colon X\to Y$ in $\catC$ satisfying $c\circ\sigma=\tau$.
A joint state $(X\otimes Y,\omega)\in\commacat{I}{\catC}$
is called a \emph{coupling} of two states
$(X,\sigma),(Y,\tau)\in\commacat{I}{\catC}$ if
\[\tikzextname{eq_coupling}
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.5) {} {};
\node [discarder] (ground) at (0.25,0.2) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (ground);
\node[scriptstyle] at (-0.45,0.4) {$X$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node (X) at (0,0.5) {};
\draw (omega) to (X);
\node[scriptstyle] at (0.2,0.3) {$X$};
\end{ctikzpicture}
\qquad\text{and}\qquad
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (Y) at (0.25,0.5);
\node [discarder] (ground) at (-0.25,0.2) {};
\draw (omega) ++(-0.25, 0) to (ground);
\draw (omega) ++(0.25, 0) to (Y);
\node[scriptstyle] at (0.45,0.4) {$Y$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\tau$};
\node (X) at (0,0.5) {};
\draw (omega) to (X);
\node[scriptstyle] at (0.2,0.3) {$Y$};
\end{ctikzpicture}
\quad.
\]
We write $\Coupl((X,\sigma),(Y,\tau))$
for the set of couplings of $(X,\sigma)$ and $(Y,\tau)$.
\begin{theorem}
Let $\catC$ be an affine CD-category that admits disintegration.
For each pair of states $(X,\sigma),(Y,\tau)\in\commacat{I}{\catC}$,
there is the following bijection:
\[
\commacat{I}{\catC}\paren[\big]{(X,\sigma),(Y,\tau)}/\sigma
\;\;
\cong
\;\;
\Coupl((X,\sigma),(Y,\tau))
\]
\end{theorem}
\begin{proof}
For each $c\in \commacat{I}{\catC}\paren[\big]{(X,\sigma),(Y,\tau)}$,
we define a joint state $I\to X\otimes Y$ to be
the `integration' of $\sigma$ and $c$ as below,
for which we use the following \emph{ad hoc} notation:
\[
\sigma\ogreaterthan c \coloneqq\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$c$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\path[scriptstyle]
node at (-0.65,1.45) {$X$}
node at (0.65,1.45) {$Y$};
\end{tikzpicture}}}
\]
It is easy to check that $\sigma\ogreaterthan c$ is a coupling of $\sigma$ and
$\tau$. For two channels $c,d\colon X\to Y$, we have
$\sigma\ogreaterthan c=\sigma\ogreaterthan d$ if and only if $c\equpto[\sigma] d$, by the
definition of $\equpto[\sigma]$. This means the mapping
\[
c \longmapsto\sigma\ogreaterthan c
\,,\quad
\commacat{I}{\catC}\paren[\big]{(X,\sigma),(Y,\tau)}/\sigma
\longto
\Coupl((X,\sigma),(Y,\tau))
\]
\noindent is well-defined and injective. To prove the surjectivity
let $(X\otimes Y,\omega)\in \Coupl((X,\sigma),(Y,\tau))$. Let
$c\colon X\to Y$ be a disintegration of $\omega$. Then $c$ is
state-preserving since
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\tau$};
\coordinate (Y) at ([yshiftu=0.3]omega);
\draw (omega) to (Y);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (omega1) at ([xshiftu=-0.25]omega);
\coordinate (omega2) at ([xshiftu=0.25]omega);
\coordinate (Y) at ([yshiftu=0.45]omega2);
\node[discarder] (d) at ([yshiftu=0.2]omega1) {};
\draw (omega2) to (Y);
\draw (omega1) to (d);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (omega1) at ([xshiftu=-0.25]omega);
\coordinate (omega2) at ([xshiftu=0.25]omega);
\node[copier] (copier) at ([yshiftu=0.45]omega1) {};
\node[arrow box] (c) at (0.25,1.05) {$c$};
\node[discarder] (X) at (-0.75,1.4) {};
\coordinate (Y) at ([yshiftu=0.2]c.north);
\node[discarder] (d) at ([yshiftu=0.2]omega2) {};
\draw (omega1) to (copier);
\draw (omega2) to (d);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (omega1) at ([xshiftu=-0.25]omega);
\coordinate (omega2) at ([xshiftu=0.25]omega);
\node[arrow box,anchor=south] (c) at ([yshiftu=0.4]omega1) {$c$};
\coordinate (X) at ([yshiftu=0.2]c.north);
\node[discarder] (d) at ([yshiftu=0.2]omega2) {};
\draw (omega1) to (c) to (X);
\draw (omega2) to (d);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[arrow box,anchor=south] (c) at ([yshiftu=0.2]omega) {$c$};
\coordinate (X) at ([yshiftu=0.2]c.north);
\draw (omega) to (c) to (X);
\end{tikzpicture}}}
\]
Moreover we have $\sigma\ogreaterthan c=\omega$, as desired.
\end{proof}
Via the symmetry $X\otimes Y\overset{\cong}{\to} Y\otimes X$
we have the obvious bijection
$\Coupl((X,\sigma),(Y,\tau))\cong\Coupl((Y,\tau),(X,\sigma))$.
This immediately gives the following corollary.
\begin{corollary}
Let $\catC$ be an affine CD-category that admits disintegration.
For any states $(X,\sigma),(Y,\tau)\in\commacat{I}{\catC}$
we have
\[
\commacat{I}{\catC}\paren[\big]{(X,\sigma),(Y,\tau)}/\sigma
\;\;
\cong
\;\;
\commacat{I}{\catC}\paren[\big]{(Y,\tau),(X,\sigma)}/\tau
\]
The bijection sends a channel $c\colon X\to Y$
to a Bayesian inversion $d\colon Y\to X$ for $\sigma$ along $c$.
\qed
\end{corollary}
Theorem~2 of~\cite{ClercDDG2017} is obtained as an instance, for the
category $\pKrnsb$. This bijective correspondence yields a `dagger'
$(-)^{\dag}$ functor on (a suitable quotient of) the comma category
$\commacat{I}{\catC}$ --- as noted by the authors
of~\cite{ClercDDG2017}.
\subsection*{Strong almost equality}
Unfortunately,
the almost equality defined above
is not the most useful notion
for equational reasoning
between string diagrams.
Indeed, later
in the proofs of
Proposition~\ref{prop:disint-identitiy}
and Theorem~\ref{thm:likelihood}
we encounter situations
where we need a stronger notion of
almost equality.
We define the stronger one as follows.
\begin{definition}
\label{def:str-almost-eq}
Let $c,d\colon X\to Y$ be channels
and $\sigma\colon I\to X$ be a state.
We say that $c$ is \emph{strongly $\sigma$-almost equal}
to $d$ if
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\node[arrow box] (c) at (-0.3,0.5) {$c$};
\coordinate (X) at (-0.3,1) {};
\coordinate (Y) at (0.3,1) {};
\draw (omega) ++(-.3,0) to (c) to (X);
\draw (omega) ++(.3,0) to (Y);
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\node[arrow box] (c) at (-0.3,0.5) {$d$};
\coordinate (X) at (-0.3,1) {};
\coordinate (Y) at (0.3,1) {};
\draw (omega) ++(-.3,0) to (c) to (X);
\draw (omega) ++(.3,0) to (Y);
\end{ctikzpicture}
\]
holds for any $\omega\colon I\to X\otimes Z$ such
that $\sigma$ is the
first marginal of $\omega$, that is:
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node (X) at (0,0.5) {};
\draw (omega) to (X);
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.5) {} {};
\node [discarder] (ground) at (0.25,0.2) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (ground);
\end{ctikzpicture}
\;\;.
\]
\end{definition}
Notice that strong almost quality implies
almost quality,
via the following $\omega$:
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.4);
\coordinate (Y) at (0.25,0.4);
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (Y);
\end{ctikzpicture}
\;\;\coloneqq\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.2) {};
\coordinate (X) at (-0.3,0.5);
\coordinate (Y) at (0.3,0.5);
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90] (X);
\draw (copier) to[out=15,in=-90] (Y);
\end{ctikzpicture}
\;\;.
\]
\noindent
The good news is that
the converse often holds too.
We say that an affine CD-category
admits \emph{equality strengthening}
if $c$ is strongly $\sigma$-almost equal
to $d$ whenever
$c\equpto[\sigma]d$,
i.e.\ $c$ is $\sigma$-almost equal to $d$.
We present two propositions that guarantee this property.
\begin{proposition}
\label{prop:disint-eq-str}
If an affine CD-category admits disintegration,
then it admits equality strengthening.
\end{proposition}
\begin{proof}
Suppose that
$c\equpto[\sigma]d$
holds for a state $\sigma\colon I\to X$
and for channels $c,d\colon X\to Y$.
Let $\omega\colon I\to X\otimes Z$
be a state whose first marginal is $\sigma$.
We can disintegrate $\omega$ as in:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.3,.5);
\coordinate (Y) at (0.3,.5);
\draw (omega) ++(-.3,0) to (X);
\draw (omega) ++(.3,0) to (Y);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (0.5,0.95) {$e$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\end{tikzpicture}}}
\;\;\;\;.
\]
Then we have
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\node[arrow box] (c) at (-0.3,0.5) {$c$};
\coordinate (X) at (-0.3,1) {};
\coordinate (Y) at (0.3,1) {};
\draw (omega) ++(-.3,0) to (c) to (X);
\draw (omega) ++(.3,0) to (Y);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (-0.5,0.95) {$c$};
\node[arrow box] (e) at (0.5,0.95) {$e$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90] (c);
\draw (c) to (X);
\draw (copier) to[out=15,in=-90] (e);
\draw (e) to (Y);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[arrow box] (c) at (-0.5,0.95) {$d$};
\node[arrow box] (e) at (0.5,0.95) {$e$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90] (c);
\draw (c) to (X);
\draw (copier) to[out=15,in=-90] (e);
\draw (e) to (Y);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\node[arrow box] (c) at (-0.3,0.5) {$d$};
\coordinate (X) at (-0.3,1) {};
\coordinate (Y) at (0.3,1) {};
\draw (omega) ++(-.3,0) to (c) to (X);
\draw (omega) ++(.3,0) to (Y);
\end{tikzpicture}}}
\;\;.
\]
Therefore $c$ is strongly $\sigma$-almost equal to $d$.
\end{proof}
Recall that $\Kl(\Giry)$ does not admit disintegration.
Nevertheless, it admits equality strengthening.
\begin{proposition}
\label{prop:KlG-eq-str}
The category $\Kl(\Giry)$ admits equality strengthening.
\end{proposition}
\begin{proof}
Assume $c\equpto[\sigma]d$
for $\sigma\in\Giry(X)$
and $c,d\colon X\to \Giry(Y)$.
Let $\omega\in\Giry(X\otimes Z)$
be a probability measure whose
first marginal is $\sigma$,
i.e.\ $(\pi_1)_*(\omega)=\sigma$.
We need to prove
$(c\otimes \eta_Z)\klcirc \omega=(d\otimes \eta_Z)\klcirc \omega$,
which is equivalent to:
\begin{equation}
\label{eq:desired-eq1}
\int_{X\times Z}
c(x)(B)\indic{C}(z)
\,\omega(\dd(x,z))
=
\int_{X\times Z}
d(x)(B)\indic{C}(z)
\,\omega(\dd(x,z))
\end{equation}
for all $B\in\Sigma_Y$ and $C\in\Sigma_Z$.
Using
\[
\abs[\big]{c(x)(B)\indic{C}(z)
-d(x)(B)\indic{C}(z)}
=
\abs[\big]{c(x)(B) -d(x)(B)}\indic{C}(z)
\le
\abs[\big]{c(x)(B) -d(x)(B)}
\enspace,
\]
we have
\begin{align*}
&
\abs[\Big]{\int_{X\times Z}
\paren[\big]{c(x)(B)\indic{C}(z)
-d(x)(B)\indic{C}(z)}
\,\omega(\dd(x,z))}
\\
&\le
\int_{X\times Z}
\abs[\big]{c(x)(B)\indic{C}(z)
-d(x)(B)\indic{C}(z)}
\,\omega(\dd(x,z))
\\
&\le
\int_{X\times Z}
\abs[\big]{c(x)(B) -d(x)(B)}
\,\omega(\dd(x,z))
\\
&=
\int_{X}
\abs[\big]{c(x)(B) -d(x)(B)}
\,(\pi_1)_*(\omega)(\dd x)
\\
&=
\int_{X}
\abs[\big]{c(x)(B) -d(x)(B)}
\,\sigma(\dd x)
\\
&=
0\enspace,
\end{align*}
where the last equality holds
since $c(-)(B)=d(-)(B)$
$\sigma$-almost everywhere
by Proposition~\ref{prop:equality-up-to-giry}.
Therefore the desired equality~\eqref{eq:desired-eq1} holds.
\end{proof}
\section{Conditional independence}\label{sec:conditionalindependence}
Throughout this section, we consider an affine CD-category
that admits disintegration.
\subsection{Disintegration of multipartite states}
\tikzextname{ss_disint}
So far we have concentrated on bipartite states --- except in the
classification example in Section~\ref{sec:classifier}. In order to
deal with a general $n$-partite state $\omega\colon I\to
X_1\otimes\dotsb\otimes X_n$, we will introduce several notations and
conventions in Definitions~\ref{def:notation-marginal},
\ref{def:notation-disintegration}
and~\ref{def:convention-almost-equal} below; they are in line with
standard practice in probability theory.
In the conventions, an $n$-partite state, as below, is fixed, and used
implicitly.
\[
\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\draw (omega) -- (-1.0, 0) to (-1.0,0.4);
\draw (omega) ++(-0.5, 0) to (-0.5,0.4);
\draw (omega) ++(1.0, 0) to (1.0,0.4);
\node[font=\normalsize] at (0.2,0.55) {$\dotso$};
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-1,0.55) {$X_1$}
node at (-0.5,0.55) {$X_2$}
node at (1,0.55) {$X_n$};
\end{tikzpicture}
\]
\begin{definition}
\label{def:notation-marginal}
When we write
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{2.6em}};
\draw (omega) -- (-1.0, 0) to (-1.0,0.4);
\draw (omega) ++(-0.5, 0) to (-0.5,0.4);
\draw (omega) ++(1.0, 0) to (1.0,0.4);
\node[font=\normalsize] at (0.2,0.55) {$\dotso$};
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-1,0.55) {$X_{i_1}$}
node at (-0.5,0.55) {$X_{i_2}$}
node at (1,0.55) {$X_{i_k}$};
\end{ctikzpicture}
\]
where $i_1,\dotsc,i_k$ are distinct,
it denotes the state $I\to X_{i_1}\otimes\dotsb \otimes X_{i_k}$
obtained from $\omega$ by marginalisation and permutation of wires (if necessary).
Let us give a couple of examples, for $n=5$.
\begin{align*}
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\draw (omega) ++(-0.25, 0) to +(0,0.3);
\draw (omega) ++(0.25, 0) to +(0,0.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,0.5) {$X_1$}
node at (0.25,0.5) {$X_4$};
\end{ctikzpicture}
&\;\;\coloneqq\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\node[discarder] (d1) at (-0.5,0.3) {};
\node[discarder] (d2) at (0,0.3) {};
\node[discarder] (d3) at (1,0.3) {};
\draw (omega) ++(-1.0, 0) to (-1,0.45);
\draw (omega) ++(-0.5, 0) to (d1);
\draw (omega) ++(0, 0) to (d2);
\draw (omega) ++(0.5, 0) to (0.5,0.45);
\draw (omega) ++(1.0, 0) to (d3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-1,0.6) {$X_1$}
node at (-0.3,0.15) {$X_2$}
node at (0.2,0.15) {$X_3$}
node at (0.5,0.6) {$X_4$}
node at (1.2,0.15) {$X_5$};
\end{ctikzpicture}
\\
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.4, 0) to +(0,0.3);
\draw (omega) to +(0,0.3);
\draw (omega) ++(0.4, 0) to +(0,0.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.4,0.5) {$X_4$}
node at (0,0.5) {$X_2$}
node at (0.4,0.5) {$X_5$};
\end{ctikzpicture}
&\;\;\coloneqq\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\node[discarder] (d1) at (-1,0.3) {};
\node[discarder] (d2) at (0,0.3) {};
\draw (omega) ++(-1.0, 0) to (d1);
\draw (omega) ++(-0.5, 0) to (-0.5,0.3)
to[out=90,in=-90] (0.5,0.95);
\draw (omega) ++(0, 0) to (d2);
\draw (omega) ++(0.5, 0) to (0.5,0.3)
to[out=90,in=-90] (-0.5,0.95);
\draw (omega) ++(1.0, 0) to (1,0.95);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.8,0.15) {$X_1$}
node at (0.7,0.85) {$X_2$}
node at (0.2,0.15) {$X_3$}
node at (-0.7,0.85) {$X_4$}
node at (1.2,0.85) {$X_5$};
\end{ctikzpicture}
\end{align*}
We permute wires via a combination of crossing.
This is unambiguous by the coherence theorem.
\end{definition}
Below we will use symbols $X,Y,Z,W,\dotsc$ to denote not only a single
wire $X_i$ but also multiple wires $X_i\otimes X_j\otimes\dotsb$.
Disintegrations more general than in the bipartite case are now
introduced as follows.
\begin{definition}
\label{def:notation-disintegration}
For $X=X_{i_1}\otimes \dotsb \otimes X_{i_k}$
and $Y=X_{j_1}\otimes \dotsb \otimes X_{j_l}$,
with all $i_1,\dotsc,i_k,j_1,\dotsc,j_l$ distinct,
a disintegration $X\to Y$ is defined to be a disintegration
of
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\draw (omega) ++(-0.25, 0) to +(0,0.3);
\draw (omega) ++(0.25, 0) to +(0,0.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,0.5) {$X$}
node at (0.25,0.5) {$Y$};
\end{ctikzpicture}
\enspace,
\]
the marginal state given by the previous convention.
We denote the disintegration simply as on the left below,
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {};
\draw (0,0.05) to (a);
\draw (a) to (0,0.95);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0,1.1) {$Y$}
node at (0,-0.1) {$X$};
\end{ctikzpicture}
\qquad\qquad\qquad\qquad\qquad
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (copier) at (0,0.15) {};
\node[arrow box] (c) at (0.35,0.6) {};
\coordinate (X) at (-0.35,1) {} {};
\coordinate (Y) at (0.35,1) {} {};
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90]
(-0.35,0.55) to (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0.35,1.15) {$Y$}
node at (-0.35,1.15) {$X$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\draw (omega) ++(-0.25, 0) to +(0,0.3);
\draw (omega) ++(0.25, 0) to +(0,0.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,0.5) {$X$}
node at (0.25,0.5) {$Y$};
\end{ctikzpicture}
\]
By definition, it must satisfy the equation on the right above.
Let us give an example.
The disintegration $X_5\otimes X_2\to X_1\otimes X_4$
on the left below is defined by the equation on the right.
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\draw (-0.25,0.05) to ([xshiftu=-0.25]a.south);
\draw (0.25,0.05) to ([xshiftu=0.25]a.south);
\draw ([xshiftu=-0.25]a.north) to (-0.25,0.95);
\draw ([xshiftu=0.25]a.north) to (0.25,0.95);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,1.1) {$X_1$}
node at (-0.25,-0.1) {$X_5$}
node at (0.25,-0.1) {$X_2$}
node at (0.25,1.1) {$X_4$};
\end{ctikzpicture}
\qquad\qquad\qquad\qquad
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (-0.45,0.8) {\;\;\;\;\;\;\;};
\node[copier] (c1) at (-0.25,0.2) {};
\node[copier] (c2) at (0.25,0.2) {};
\node[state] (s) at (0,0) {\;\;\;\;};
\draw (s) ++(-0.25,0) to (c1);
\draw (s) ++(0.25,0) to (c2);
\draw (c1) to[out=165,in=-90] ([xshiftu=-0.25]a.south);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.25]a.south);
\draw ([xshiftu=-0.25]a.north) to (-0.7,1.25);
\draw ([xshiftu=0.25]a.north) to (-0.2,1.25);
\draw (c1) to[out=15,in=-90] (0.2,0.55) to (0.2,1.25);
\draw (c2) to[out=15,in=-90] (0.65,0.55) to (0.65,1.25);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.4) {$X_1$}
node at (0.2,1.4) {$X_5$}
node at (0.65,1.4) {$X_2$}
node at (-0.2,1.4) {$X_4$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;\;};
\draw (omega) ++(-0.6, 0) to +(0,0.3);
\draw (omega) ++(-0.2, 0) to +(0,0.3);
\draw (omega) ++(0.2, 0) to +(0,0.3);
\draw (omega) ++(0.6, 0) to +(0,0.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.6,0.45) {$X_1$}
node at (-0.2,0.45) {$X_4$}
node at (0.2,0.45) {$X_5$}
node at (0.6,0.45) {$X_2$};
\end{ctikzpicture}
\]
More specifically, assuming $n=5$ and
expanding the notation for marginals,
the equation is:
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (-0.45,0.8) {\;\;\;\;\;\;\;};
\node[copier] (c1) at (-0.25,0.2) {};
\node[copier] (c2) at (0.25,0.2) {};
\node[state] (omega) at (0,-0.75) {\hspace*{1em}$\omega$\hspace*{1em}};
\node[discarder] (d1) at (-1,-0.45) {};
\node[discarder] (d3) at (0,-0.45) {};
\node[discarder] (d4) at (0.5,-0.45) {};
\draw (c1) to[out=165,in=-90] ([xshiftu=-0.25]a.south);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.25]a.south);
\draw ([xshiftu=-0.25]a.north) to (-0.7,1.25);
\draw ([xshiftu=0.25]a.north) to (-0.2,1.25);
\draw (c1) to[out=15,in=-90] (0.2,0.55) to (0.2,1.25);
\draw (c2) to[out=15,in=-90] (0.65,0.55) to (0.65,1.25);
\draw (omega) ++(-1,0) to (d1);
\draw (omega) ++(-0.5,0) to (-0.5,-0.5)
to[out=90,in=-90] (0.25,0.2);
\draw (omega) ++(0,0) to (d3);
\draw (omega) ++(0.5,0) to (d4);
\draw (omega) ++(1,0) to (1,-0.55) to[out=90,in=-90] (-0.25,0.2);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.4) {$X_1$}
node at (0.65,1.4) {$X_2$}
node at (-0.8,-0.6) {$X_1$}
node at (0.2,-0.6) {$X_3$}
node at (0.7,-0.6) {$X_4$}
node at (-0.2,1.4) {$X_4$}
node at (0.2,1.4) {$X_5$};
\end{ctikzpicture}
=
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\node[discarder] (d2) at (0,0.3) {};
\draw (omega) ++(-1.0, 0) to (-1,0.95);
\draw (omega) ++(-0.5, 0) to (-0.5,0.3)
to[out=90,in=-90] (0.5,0.95);
\draw (omega) ++(0, 0) to (d2);
\draw (omega) ++(0.5, 0) to (0.5,0.15)
to[out=90,in=-90] (-0.5,0.95);
\draw (omega) ++(1.0, 0) to (1,0.15) to[out=90,in=-90] (0.05,0.95);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-1,1.05) {$X_1$}
node at (0.5,1.05) {$X_2$}
node at (0.2,0.15) {$X_3$}
node at (-0.5,1.05) {$X_4$}
node at (0.05,1.05) {$X_5$};
\end{ctikzpicture}
\]
Note that disintegrations need not be unique.
Thus when we write
$\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {};
\draw (0,0.05) to (a);
\draw (a) to (0,0.95);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0.15,0.9) {$Y$}
node at (0.15,0.1) {$X$};
\end{ctikzpicture}$,
we in fact \emph{choose} one of them.
Nevertheless, such disintegrations are unique up to almost-equality
with respect to $\begin{ctikzpicture}[font=\small]
\node[state] (a) at (0,0.5) {};
\draw (a) to (0,0.75);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0.15,0.65) {$X$};
\end{ctikzpicture}$,
which is good enough for our purpose.
\end{definition}
Finally we make a convention about almost equality
(Definition~\ref{def:almost-equal}).
\begin{definition}
\label{def:convention-almost-equal}
Let $S$ and $T$ be string diagrams of type $X\to Y$
that are made from marginals and disintegrations of $\omega$
as defined in Definitions~\ref{def:notation-marginal} and \ref{def:notation-disintegration}.
When we say $S$ is almost equal to $T$ (or write $S\equpto T$) without reference to
a state, it means that
$S$ is almost equal to $T$ with respect to the state $\begin{ctikzpicture}[font=\small]
\node[state] (a) at (0,0.5) {};
\draw (a) to (0,0.75);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0.15,0.65) {$X$};
\end{ctikzpicture}$.
\end{definition}
We shall make use of the following auxiliary equations involving
discarding and composition of disintegrations.
\begin{proposition}
\label{prop:disint-identitiy}
\tikzextname{prop_disint_identitiy}
In the conventions and notations above,
the following hold.
\begin{enumerate}
\setlength{\abovedisplayskip}{-.5\baselineskip}
\setlength{\abovedisplayshortskip}{-.5\baselineskip}
\setlength{\belowdisplayskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}
\item\label{propen:disint-marg}
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\node[discarder] (d) at (0.25,1.05) {};
\draw (0,0.05) to (a);
\draw ([xshiftu=-0.25]a.north) to (-0.25,1.25);
\draw ([xshiftu=0.25]a.north) to (d);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,1.4) {$X$}
node at (0.4,0.9) {$Y$}
node at (0,-0.1) {$Z$};
\end{ctikzpicture}
\;\;\equpto\;\;
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {};
\draw (0,0.05) to (a);
\draw (a) to (0,0.95);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0,1.1) {$X$}
node at (0,-0.1) {$Z$};
\end{ctikzpicture}
\]
\item\label{propen:comp-disintegration}
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\node[arrow box] (b) at (0.5,-0.35) {\;\;\;\;\;\;\;};
\node[copier] (c) at (0,-0.8) {};
\node[copier] (c2) at (0.5,0.05) {};
\draw (a) to (0,0.9);
\draw (c) to[out=165,in=-90] (-0.25,-0.55) to ([xshiftu=-0.25]a.south);
\draw (c) to[out=15,in=-90] ([xshiftu=-0.25]b.south);
\draw (b) to (c2);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.25]a.south);
\draw (c2) to[out=15,in=-90] (0.75,0.45) to (0.75,0.9);
\draw (0,-1) to (c);
\draw (0.75,-1) to ([xshiftu=0.25]b.south);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0,1.05) {$X$}
node at (0,-1.15) {$Y$}
node at (0.75,-1.15) {$W$}
node at (0.75,1.05) {$Z$};
\end{ctikzpicture}
\;\;\equpto\;\;
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\draw (-0.25,0.05) to ([xshiftu=-0.25]a.south);
\draw (0.25,0.05) to ([xshiftu=0.25]a.south);
\draw ([xshiftu=-0.25]a.north) to (-0.25,0.95);
\draw ([xshiftu=0.25]a.north) to (0.25,0.95);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,1.1) {$X$}
node at (-0.25,-0.1) {$Y$}
node at (0.25,-0.1) {$W$}
node at (0.25,1.1) {$Z$};
\end{ctikzpicture}
\]
\end{enumerate}
\end{proposition}
\begin{proof}
By the definition of almost equality,
\ref{propen:disint-marg} is proved by:
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\node[discarder] (d) at (0.25,1.05) {};
\node[state] (s) at (0.35,-0.25) {};
\node[copier] (c) at (0.35,-0.05) {};
\draw ([xshiftu=-0.25]a.north) to (-0.25,1.25);
\draw ([xshiftu=0.25]a.north) to (d);
\draw (s) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (c) to[out=15,in=-90] (0.7,0.3) to (0.7,1.25);
\path[scriptstyle]
node at (-0.25,1.4) {$X$}
node at (0.4,0.9) {$Y$}
node at (0.7,1.4) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\node[discarder] (d) at (0,0.3) {};
\draw (omega) ++(-0.4, 0) to +(0,0.6);
\draw (omega) to (d);
\draw (omega) ++(0.4, 0) to +(0,0.6);
\path[scriptstyle]
node at (-0.4,0.75) {$X$}
node at (0.15,0.15) {$Y$}
node at (0.4,0.75) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\draw (omega) ++(-0.25, 0) to +(0,0.3);
\draw (omega) ++(0.25, 0) to +(0,0.3);
\path[scriptstyle]
node at (-0.25,0.45) {$X$}
node at (0.25,0.45) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {};
\node[state] (s) at (0.35,-0.25) {};
\node[copier] (c) at (0.35,-0.05) {};
\draw (a) to (0,0.95);
\draw (s) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (c) to[out=15,in=-90] (0.7,0.3) to (0.7,0.95);
\path[scriptstyle]
node at (0,1.1) {$X$}
node at (0.7,1.1) {$Z$};
\end{ctikzpicture}
\quad.
\]
Similarly, we prove~\ref{propen:comp-disintegration} as follows.
\begin{align*}
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\node[arrow box] (b) at (0.5,-0.35) {\;\;\;\;\;\;\;};
\node[copier] (c) at (0,-0.8) {};
\node[copier] (c2) at (0.5,0.05) {};
\node[copier] (c3) at (0.55,-1.15) {};
\node[copier] (c4) at (1.05,-1.15) {};
\node[state] (s) at (0.8,-1.35) {\;\;\;\;};
\draw (a) to (0,0.9);
\draw (c) to[out=165,in=-90] (-0.25,-0.55) to ([xshiftu=-0.25]a.south);
\draw (c) to[out=15,in=-90] ([xshiftu=-0.25]b.south);
\draw (b) to (c2);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.25]a.south);
\draw (c2) to[out=15,in=-90] (0.75,0.45) to (0.75,0.9);
\draw (c3) to[out=165,in=-90] (c);
\draw (c4) to[out=150,in=-90] ([xshiftu=0.25]b.south);
\draw (c3) to[out=15,in=-90] (1.25,-0.55) to (1.25,0.9);
\draw (c4) to[out=15,in=-90] (1.65,-0.55) to (1.65,0.9);
\draw (s) ++(-0.25, 0) to (c3);
\draw (s) ++(0.25, 0) to (c4);
\path[scriptstyle]
node at (0,1.05) {$X$}
node at (1.25,1.05) {$Y$}
node at (1.65,1.05) {$W$}
node at (0.75,1.05) {$Z$};
\end{ctikzpicture}
&\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.8) {\;\;\;\;\;\;\;};
\node[arrow box] (b) at (0.5,-0.35) {\;\;\;\;\;\;\;};
\node[copier] (c) at (1.25,-0.05) {};
\node[copier] (c2) at (0.5,0.35) {};
\node[copier] (c3) at (0.7,-1) {};
\node[copier] (c4) at (1.2,-1) {};
\node[state] (s) at (0.95,-1.2) {\;\;\;\;};
\draw (a) to (0,1.2);
\draw (b) to (c2);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.25]a.south);
\draw (c2) to[out=15,in=-90] (0.75,0.75) to (0.75,1.2);
\draw (c3) to[out=165,in=-90] ([xshiftu=-0.25]b.south);
\draw (c4) to[out=165,in=-90] ([xshiftu=0.25]b.south);
\draw (c3) to[out=15,in=-90] (1.25,-0.55) to (c) to (1.25,1.2);
\draw (c) .. controls (0.3,0.1) and (-0.25,0.25) .. ([xshiftu=-0.25]a.south);
\draw (c4) to[out=15,in=-90] (1.65,-0.55) to (1.65,1.2);
\draw (s) ++(-0.25,0) to (c3);
\draw (s) ++(0.25,0) to (c4);
\path[scriptstyle]
node at (0,1.35) {$X$}
node at (1.25,1.35) {$Y$}
node at (1.65,1.35) {$W$}
node at (0.75,1.35) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0.2,0.75) {\;\;\;\;\;\;\;};
\node[copier] (c) at (1.15,-0.05) {};
\node[copier] (c2) at (0.75,0.25) {};
\node[state] (s) at (1.15,-0.25) {\;\;\;\;\;\;};
\draw (s) ++(-0.4,0) to (c2);
\draw (s) to (c) to[out=65,in=-90] (1.4,1.15);
\draw (s) ++(0.4,0) to[out=90,in=-90] (1.75,1.15);
\draw (a) to (0.2,1.15);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.25]a.south);
\draw (c2) to[out=15,in=-90] (1,0.7) to (1,1.15);
\draw (c) .. controls (0.3,0.1) and (-0.05,0.3) .. ([xshiftu=-0.25]a.south);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0.2,1.3) {$X$}
node at (1.4,1.3) {$Y$}
node at (1.75,1.3) {$W$}
node at (1,1.3) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0.2,0.7) {\;\;\;\;\;\;\;};
\node[copier] (c) at (0.9,0.1) {};
\node[copier] (c2) at (0.5,0.1) {};
\node[state] (s) at (0.9,-0.2) {\;\;\;\;\;\;};
\draw (s) ++(-0.4,0) to (c2);
\draw (s) to (c);
\draw (s) ++(0.4,0) to[out=90,in=-90] (1.6,0.45) to (1.6,1.15);
\draw (a) to (0.2,1.15);
\draw (c) to[out=165,in=-90] ([xshiftu=0.25]a.south);
\draw (c2) to[out=165,in=-90] ([xshiftu=-0.25]a.south);
\draw (c) to[out=15,in=-90] (1.25,0.55) to (1.25,0.7) to[out=90,in=-90] (0.85,1.15);
\draw (c2) to[out=15,in=-90] (0.85,0.55) to (0.85,0.7) to[out=90,in=-90] (1.25,1.15);
\path[scriptstyle]
node at (0.2,1.3) {$X$}
node at (1.25,1.3) {$Y$}
node at (1.6,1.3) {$W$}
node at (0.85,1.3) {$Z$};
\end{ctikzpicture}
\\
&\;\;\overset{\star}{=}\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.45, 0) to (-0.45,0.7);
\draw (omega) ++(-0.15, 0) to (-0.15,0.3) to[out=90,in=-90] (0.15,0.7);
\draw (omega) ++(0.15, 0) to (0.15,0.3) to[out=90,in=-90] (-0.15,0.7);
\draw (omega) ++(0.45, 0) to (0.45,0.7);
\path[scriptstyle]
node at (-0.45,0.85) {$X$}
node at (-0.15,0.85) {$Z$}
node at (0.15,0.85) {$Y$}
node at (0.45,0.85) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.45, 0) to (-0.45,0.3);
\draw (omega) ++(-0.15, 0) to (-0.15,0.3);
\draw (omega) ++(0.15, 0) to (0.15,0.3);
\draw (omega) ++(0.45, 0) to (0.45,0.3);
\path[scriptstyle]
node at (-0.45,0.45) {$X$}
node at (-0.15,0.45) {$Z$}
node at (0.15,0.45) {$Y$}
node at (0.45,0.45) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,-0.05) {\;\;\;\;};
\node[copier] (c) at (-0.25,0.15) {};
\node[copier] (c2) at (0.25,0.15) {};
\node[arrow box] (b) at (-0.5,0.7) {\;\;\;\;\;\;\;};
\draw (omega) ++ (-0.25,0) to (c);
\draw (c) to[out=165,in=-90] ([xshiftu=-0.25]b.south);
\draw (c) to[out=15,in=-90] (0.25,0.55)
to (0.25,1.15);
\draw (omega) ++ (0.25,0) to (c2);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.25]b.south);
\draw (c2) to[out=15,in=-90] (0.65,0.55) to (0.65,1.15);
\draw (b.north) ++ (-0.25,0) to (-0.75,1.15);
\draw (b.north) ++ (0.25,0) to (-0.25,1.15);
\path[scriptstyle]
node at (-0.75,1.3) {$X$}
node at (0.25,1.3) {$Y$}
node at (-0.25,1.3) {$Z$}
node at (0.65,1.3) {$W$};
\end{ctikzpicture}
\end{align*}
The marked equality $\overset{\star}{=}$
holds by strong almost equality, see Proposition~\ref{prop:disint-eq-str}.
\end{proof}
The equations correspond respectively to
$\sum_y\Pr(x,y|z)=\Pr(x|z)$
and $\Pr(x|y,z)\cdot \Pr(z|y,w)=\Pr(x,z|y,w)$
in discrete probability.
\begin{remark}
We here keep our notation somewhat informal,
e.g.\ using symbols $X,Y,Z,\dotsc$ as a sort of meta-variables.
We refer to \cite{JoyalS1991,Selinger2010}
for more formal aspects of string diagrams.
\end{remark}
\subsection{Conditional independence}
\tikzextname{ss_cind}
We continue using the notations in the previous subsection.
Recall that we fix an $n$-partite state
\[
\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\hspace*{1em}$\omega$\hspace*{1em}};
\draw (omega) -- (-1.0, 0) to (-1.0,0.4);
\draw (omega) ++(-0.5, 0) to (-0.5,0.4);
\draw (omega) ++(1.0, 0) to (1.0,0.4);
\node[font=\normalsize] at (0.2,0.55) {$\dotso$};
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-1,0.55) {$X_1$}
node at (-0.5,0.55) {$X_2$}
node at (1,0.55) {$X_n$};
\end{tikzpicture}
\]
and use symbols $X,Y,Z,W,\dotsc$
to denote a wire $X_i$ or multiple wires $X_i\otimes X_j\otimes\dotsb$.
We now introduce the notion of conditional independence. Although it
is defined with respect to the underlying state $\omega$, we leave the
state $\omega$ implicit, like an underlying probability space $\Omega$
in conventional probability theory.
\begin{definition}
Let $X,Y,Z$ denote distinct wires.
Then we say $X$ and $Y$ are conditionally independent given $Z$,
written as $\cind{X}{Y}{Z}$, if
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\draw (0,0) to (a);
\draw (a.north) ++(-0.25,0) to (-0.25,1);
\draw (a.north) ++(0.25,0) to (0.25,1);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,1.2) {$X$}
node at (0.25,1.2) {$Y$}
node at (0,-0.2) {$Z$};
\end{ctikzpicture}
\;\;\;\equpto\;\;\;
\begin{ctikzpicture}[font=\small]
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.4,0.8) {};
\node[arrow box] (b) at (0.4,0.8) {};
\draw (0,0) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.4,1.3);
\draw (b) to (0.4,1.3);
\draw (c) to[out=15,in=-90] (b);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.4,1.5) {$X$}
node at (0.4,1.5) {$Y$}
node at (0,-0.2) {$Z$};
\end{ctikzpicture}
\quad.
\]
\end{definition}
The definition is analogous to
the condition $\Pr(x,y|z)=\Pr(x|z)\Pr(y|z)$
in discrete probability.
Indeed our definition coincides with the usual conditional
independence,
as explained below.
\begin{example}
In $\Kl(\Dst)$,
let $c_{X|Z}\colon Z\to \Dst(X)$,
$c_{Y|Z}\colon Z\to \Dst(Y)$,
$c_{XY|Z}\colon Z\to \Dst(X\times Y)$
be disintegrations of some joint state, say $\omega\in\Dst(X\times Y\times Z)$.
Let $\omega_Z\in\Dst(Z)$ be the marginal on $Z$.
Then $\cind{X}{Y}{Z}$ if and only if
\[
c_{XY|Z}(z)(x,y)=c_{X|Z}(z)(x)\cdot c_{Y|Z}(z)(y)
\quad \text{whenever} \quad
\omega_Z(z)\ne 0
\]
for all $x\in X$, $y\in Y$ and $z\in Z$.
If we write $\Pr(x,y|z)=c_{XY|Z}(z)(x,y)$,
$\Pr(x|z)=c_{X|Z}(z)(x)$,
$\Pr(y|z)=c_{Y|Z}(z)(y)$,
and $\Pr(z)=\omega_Z(z)$,
then the condition will look more familiar:
\[
\Pr(x,y|z) = \Pr(x|z)\cdot \Pr(y|z)
\quad \text{whenever} \quad
\Pr(z)\ne 0
\enspace.
\]
\end{example}
\begin{example}
Similarly, in $\Kl(\Giry)$,
let $c_{X|Z}\colon Z\to \Giry(X)$,
$c_{Y|Z}\colon Z\to \Giry(Y)$,
$c_{XY|Z}\colon Z\to \Giry(X\times Y)$,
and $\omega_Z\in\Giry(Z)$
be appropriate disintegrations and a marginal of some joint probability measure $\omega$.
Then $\cind{X}{Y}{Z}$ if and only if
\[
c_{XY|Z}(z)(A\times B)=c_{X|Z}(z)(A)\cdot c_{Y|Z}(z)(B)
\qquad
\text{for $\omega_Z$-almost all $z\in Z$}
\]
for all $A\in \Sigma_X$ and $B\in \Sigma_Y$.
\end{example}
The equivalences in the next result are well-known in conditional
probability. Our contribution is that we formulate and prove them at
an abstract, graphical level.
\begin{proposition}
\label{prop:equiv-cind}\tikzextname{prop_equiv_cind}
The following are equivalent.
\begin{enumerate}
\setlength{\abovedisplayskip}{-.5\baselineskip}
\setlength{\abovedisplayshortskip}{-.5\baselineskip}
\setlength{\belowdisplayskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}
\item\label{propen:cind}
$\cind{X}{Y}{Z}$
\item\label{propen:factor}
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.4, 0) to +(0,0.3);
\draw (omega) to +(0,0.3);
\draw (omega) ++(0.4, 0) to +(0,0.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.4,0.5) {$X$}
node at (0,0.5) {$Y$}
node at (0.4,0.5) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.7,0.8) {};
\node[arrow box] (b) at (0,0.8) {};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.7,1.3);
\draw (c) to (b);
\draw (b) to (0,1.3);
\draw (c) to[out=15,in=-90] (0.7,0.6)
to (0.7,1.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.5) {$X$}
node at (0,1.5) {$Y$}
node at (0.7,1.5) {$Z$};
\end{ctikzpicture}
\]
\item\label{propen:alt}
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\draw (a) to (0,1);
\draw (0.25,0) to ([xshiftu=0.25]a.south);
\draw (-0.25,0) to ([xshiftu=-0.25]a.south);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0,1.2) {$X$}
node at (-0.25,-0.2) {$Y$}
node at (0.25,-0.2) {$Z$};
\end{ctikzpicture}
\;\;\equpto\;\;
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {};
\node[discarder] (d) at (-0.6,0.4) {};
\draw (a) to (0,1);
\draw (0,0) to (a);
\draw (-0.6,0) to (d);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0,1.2) {$X$}
node at (-0.6,-0.2) {$Y$}
node at (0,-0.2) {$Z$};
\end{ctikzpicture}
\]
\item\label{propen:factor2}
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.4, 0) to +(0,0.3);
\draw (omega) to +(0,0.3);
\draw (omega) ++(0.4, 0) to +(0,0.3);
\tikzset{font=\normalsize,
execute at begin node=\everymath{\scriptstyle}}
\node at (-0.4,0.5) {$X$};
\node at (0,0.5) {$Y$};
\node at (0.4,0.5) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\node[copier] (c) at (0.25,0.2) {};
\node[arrow box] (a) at (-0.45,1) {};
\draw (omega) ++(-0.25, 0) to +(0,0.15)
to[out=90,in=-90] (0.1,0.6) to (0.1,1.45);
\draw (omega) ++(0.25, 0) to (c);
\draw (c) to[out=150,in=-90] (a);
\draw (c) to[out=60,in=-90] (0.5,1.45);
\draw (a) to (-0.45,1.45);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.45,1.6) {$X$}
node at (0.1,1.6) {$Y$}
node at (0.5,1.6) {$Z$};
\end{ctikzpicture}
\]
\end{enumerate}
\end{proposition}
As we will see below,
conditional independence $\cind{X}{Y}{Z}$
is symmetric in $X$ and~$Y$.
Therefore the obvious symmetric counterparts
of \ref{propen:alt} and \ref{propen:factor2}
are also equivalent to them.
\begin{proof}\tikzextname{pf_equiv_cind}
By definition of almost equality,
\ref{propen:cind} is equivalent to
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\node[copier] (c2) at (0.4,-0.1) {};
\node[state] (s) at (0.4,-0.3) {};
\draw (s) to (c2);
\draw (c2) to[out=165,in=-90] (a);
\draw (c2) to[out=30,in=-90] (0.8,1);
\draw (a.north) ++(-0.25,0) to (-0.25,1);
\draw (a.north) ++(0.25,0) to (0.25,1);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,1.2) {$X$}
node at (0.25,1.2) {$Y$}
node at (0.8,1.2) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[copier] (c) at (0,0.2) {};
\node[copier] (c2) at (0.5,-0.1) {};
\node[arrow box] (a) at (-0.4,0.8) {};
\node[arrow box] (b) at (0.4,0.8) {};
\node[state] (s) at (0.5,-0.3) {};
\draw (s) to (c2);
\draw (c2) to[out=165,in=-90] (c);
\draw (c2) to[out=30,in=-90] (1,1.3);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.4,1.3);
\draw (b) to (0.4,1.3);
\draw (c) to[out=15,in=-90] (b);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.4,1.5) {$X$}
node at (0.4,1.5) {$Y$}
node at (1,1.5) {$Z$};
\end{ctikzpicture}
\;\;\eqqcolon\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.7,0.8) {};
\node[arrow box] (b) at (0,0.8) {};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.7,1.3);
\draw (c) to (b);
\draw (b) to (0,1.3);
\draw (c) to[out=15,in=-90] (0.7,0.6)
to (0.7,1.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.5) {$X$}
node at (0,1.5) {$Y$}
node at (0.7,1.5) {$Z$};
\end{ctikzpicture}
\quad.
\]
We then have \ref{propen:cind} $\Leftrightarrow$ \ref{propen:factor},
since the identity below holds by the definition of disintegration.
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\node[copier] (c2) at (0.4,-0.1) {};
\node[state] (s) at (0.4,-0.3) {};
\draw (s) to (c2);
\draw (c2) to[out=165,in=-90] (a);
\draw (c2) to[out=30,in=-90] (0.8,1);
\draw (a.north) ++(-0.25,0) to (-0.25,1);
\draw (a.north) ++(0.25,0) to (0.25,1);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,1.2) {$X$}
node at (0.25,1.2) {$Y$}
node at (0.8,1.2) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.4, 0) to +(0,0.3);
\draw (omega) to +(0,0.3);
\draw (omega) ++(0.4, 0) to +(0,0.3);
\tikzset{font=\normalsize,
execute at begin node=\everymath{\scriptstyle}}
\node at (-0.4,0.5) {$X$};
\node at (0,0.5) {$Y$};
\node at (0.4,0.5) {$Z$};
\end{ctikzpicture}
\]
Next, assuming \ref{propen:alt}, we obtain \ref{propen:factor2} as follows.
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.4, 0) to +(0,0.3);
\draw (omega) to +(0,0.3);
\draw (omega) ++(0.4, 0) to +(0,0.3);
\tikzset{font=\normalsize,
execute at begin node=\everymath{\scriptstyle}}
\node at (-0.4,0.5) {$X$};
\node at (0,0.5) {$Y$};
\node at (0.4,0.5) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\node[copier] (c) at (-0.2,0.15) {};
\node[copier] (c2) at (0.2,0.15) {};
\node[arrow box] (b) at (-0.35,0.7) {\;\;\;\;\;};
\draw (omega) ++ (-0.2,0) to (c);
\draw (c) to[out=165,in=-90] ([xshiftu=-0.2]b.south);
\draw (b) to (-0.35,1.15);
\draw (c) to[out=15,in=-90] (0.15,0.45)
to (0.15,1.15);
\draw (omega) ++ (0.2,0) to (c2);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.2]b.south);
\draw (c2) to[out=15,in=-90] (0.5,0.45)
to (0.5,1.15);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.35,1.3) {$X$}
node at (0.15,1.3) {$Y$}
node at (0.5,1.3) {$Z$};
\end{ctikzpicture}
\;\;\overset{\text{\ref{propen:alt}}}=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\node[copier] (c) at (-0.2,0.15) {};
\node[copier] (c2) at (0.2,0.15) {};
\node[arrow box] (b) at (-0.25,0.8) {};
\node[discarder] (d) at (-0.8,0.7) {};
\draw (omega) ++ (-0.2,0) to (c);
\draw (c) to[out=165,in=-90] (d);
\draw (b) to (-0.25,1.25);
\draw (c) to[out=15,in=-90] (0.15,0.55)
to (0.15,1.25);
\draw (omega) ++ (0.2,0) to (c2);
\draw (c2) to[out=150,in=-90] (b);
\draw (c2) to[out=15,in=-90] (0.5,0.55)
to (0.5,1.25);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.25,1.4) {$X$}
node at (0.15,1.4) {$Y$}
node at (0.5,1.4) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\node[copier] (c) at (0.25,0.2) {};
\node[arrow box] (a) at (-0.45,1) {};
\draw (omega) ++(-0.25, 0) to +(0,0.15)
to[out=90,in=-90] (0.1,0.6) to (0.1,1.45);
\draw (omega) ++(0.25, 0) to (c);
\draw (c) to[out=150,in=-90] (a);
\draw (c) to[out=60,in=-90] (0.5,1.45);
\draw (a) to (-0.45,1.45);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.45,1.6) {$X$}
node at (0.1,1.6) {$Y$}
node at (0.5,1.6) {$Z$};
\end{ctikzpicture}
\]
We prove
\ref{propen:factor2} $\Rightarrow$ \ref{propen:alt}
similarly.
Finally note that the following equation holds.
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.7,0.8) {};
\node[arrow box] (b) at (0,0.8) {};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.7,1.3);
\draw (c) to (b);
\draw (b) to (0,1.3);
\draw (c) to[out=15,in=-90] (0.7,0.6)
to (0.7,1.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.5) {$X$}
node at (0,1.5) {$Y$}
node at (0.7,1.5) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.3,1.65) {};
\node[arrow box] (b) at (-0.3,0.7) {};
\node[copier] (c2) at (0.3,0.9) {};
\draw (omega) to (c);
\draw (a) to (-0.3,2.05);
\draw (c) to[out=165,in=-90] (b);
\draw (b) to[out=90,in=-90] (0.2,1.4) to (0.2,2.05);
\draw (c) to[out=15,in=-90] (0.3,0.5)
to (c2);
\draw (c2) to[out=135,in=-90] (a);
\draw (c2) to[out=45,in=-90] (0.65,2.05);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.3,2.2) {$X$}
node at (0.2,2.2) {$Y$}
node at (0.65,2.2) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\node[copier] (c) at (0.25,0.2) {};
\node[arrow box] (a) at (-0.45,1) {};
\draw (omega) ++(-0.25, 0) to +(0,0.15)
to[out=90,in=-90] (0.1,0.6) to (0.1,1.45);
\draw (omega) ++(0.25, 0) to (c);
\draw (c) to[out=150,in=-90] (a);
\draw (c) to[out=60,in=-90] (0.5,1.45);
\draw (a) to (-0.45,1.45);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.45,1.6) {$X$}
node at (0.1,1.6) {$Y$}
node at (0.5,1.6) {$Z$};
\end{ctikzpicture}
\quad.
\]
From this
\ref{propen:factor}~$\Leftrightarrow$~\ref{propen:factor2}
is immediate.
\end{proof}
Note that the condition~\ref{propen:alt} of the proposition is an
analogue of $\Pr(x|y,z)=\Pr(x|z)$. The other conditions
\ref{propen:factor} and \ref{propen:factor2} say
that the joint state can be factorised in certain ways, corresponding
to the following equations:
\[
\Pr(x,y,z)
=
\Pr(x|z)\Pr(y|z)\Pr(z)
=
\Pr(x|z)\Pr(y,z).
\]
The proposition below shows that our abstract formulation of
conditional independence
does satisfy the basic `rules' of conditional independence,
which are known as
\emph{(semi-) graphoids axioms}~\cite{VermaP1988,GeigerVP1990}.
\begin{proposition}
\label{prop:graphoid}\tikzextname{prop_graphoid}
Conditional independence $\cind{(-)}{(-)}{(-)}$ satisfies:
\begin{enumerate}
\item\label{propen:symm}
(Symmetry)
$\cind{X}{Y}{Z}$ if and only if $\cind{Y}{X}{Z}$.
\item\label{propen:decomp}
(Decomposition)
$\cind{X}{Y\otimes Z}{W}$ implies $\cind{X}{Y}{W}$
and $\cind{X}{Z}{W}$.
\item\label{propen:weakunion}
(Weak union)
$\cind{X}{Y\otimes Z}{W}$ implies $\cind{X}{Y}{Z\otimes W}$.
\item\label{propen:contr}
(Contraction)
$\cind{X}{Z}{W}$ and
$\cind{X}{Y}{Z\otimes W}$
imply $\cind{X}{Y\otimes Z}{W}$.
\end{enumerate}
\end{proposition}
\begin{proof}\tikzextname{prf_graphoid}
We will freely use Proposition~\ref{prop:equiv-cind}.
(\ref{propen:symm})
Suppose $\cind{X}{Y}{Z}$. Then
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.4, 0) to +(0,0.3);
\draw (omega) to +(0,0.3);
\draw (omega) ++(0.4, 0) to +(0,0.3);
\tikzset{font=\normalsize,
execute at begin node=\everymath{\scriptstyle}}
\node at (-0.4,0.5) {$Y$};
\node at (0,0.5) {$X$};
\node at (0.4,0.5) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.4, 0) to[out=90,in=-90] +(0.4,0.5);
\draw (omega) to[out=90,in=-90] +(-0.4,0.5);
\draw (omega) ++(0.4, 0) to +(0,0.5);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0,0.7) {$X$}
node at (-0.4,0.7) {$Y$}
node at (0.4,0.7) {$Z$};
\end{ctikzpicture}
\;\;\overset{(\cind{X}{Y}{Z})}{=}\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.7,0.8) {};
\node[arrow box] (b) at (0,0.8) {};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a.north) to[out=90,in=-90] (0,1.5);
\draw (c) to (b);
\draw (b.north) to[out=90,in=-90] (-0.7,1.5);
\draw (c) to[out=15,in=-90] (0.7,0.6)
to (0.7,1.5);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.7) {$Y$}
node at (0,1.7) {$X$}
node at (0.7,1.7) {$Z$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.7,0.8) {};
\node[arrow box] (b) at (0,0.8) {};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.7,1.3);
\draw (c) to (b);
\draw (b) to (0,1.3);
\draw (c) to[out=15,in=-90] (0.7,0.6)
to (0.7,1.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.5) {$Y$}
node at (0,1.5) {$X$}
node at (0.7,1.5) {$Z$};
\end{ctikzpicture}
\enspace.
\]
This means $\cind{Y}{X}{Z}$.
(\ref{propen:decomp})
Suppose $\cind{X}{Y\otimes Z}{W}$, namely:
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.45, 0) to +(0,0.3);
\draw (omega) ++(-0.15, 0) to +(0,0.3);
\draw (omega) ++(0.15, 0) to +(0,0.3);
\draw (omega) ++(0.45, 0) to +(0,0.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.45,0.45) {$X$}
node at (-0.15,0.45) {$Y$}
node at (0.15,0.45) {$Z$}
node at (0.45,0.45) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.75,0.8) {};
\node[arrow box] (b) at (0,0.8) {\;\;\;\;\;};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.75,1.3);
\draw (c) to (b);
\draw ([xshiftu=-0.2]b.north) to (-0.2,1.3);
\draw ([xshiftu=0.2]b.north) to (0.2,1.3);
\draw (c) to[out=15,in=-90] (0.6,0.55)
to (0.6,1.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.75,1.45) {$X$}
node at (-0.2,1.45) {$Y$}
node at (0.2,1.45) {$Z$}
node at (0.6,1.45) {$W$};
\end{ctikzpicture}
\]
Marginalising $Z$, we obtain
\[
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\draw (omega) ++(-0.4, 0) to +(0,0.3);
\draw (omega) to +(0,0.3);
\draw (omega) ++(0.4, 0) to +(0,0.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.4,0.5) {$X$}
node at (0,0.5) {$Y$}
node at (0.4,0.5) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\node[discarder] (d) at (0.15,0.3) {};
\draw (omega) ++(-0.45, 0) to +(0,0.55);
\draw (omega) ++(-0.15, 0) to +(0,0.55);
\draw (omega) ++(0.15, 0) to (d);
\draw (omega) ++(0.45, 0) to +(0,0.55);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.45,0.7) {$X$}
node at (-0.15,0.7) {$Y$}
node at (0.25,0.15) {$Z$}
node at (0.45,0.7) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.75,0.8) {};
\node[arrow box] (b) at (0,0.8) {\;\;\;\;\;};
\node[discarder] (d) at (0.2,1.35) {};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.75,1.5);
\draw (c) to (b);
\draw ([xshiftu=-0.2]b.north) to (-0.2,1.5);
\draw ([xshiftu=0.2]b.north) to (d);
\draw (c) to[out=15,in=-90] (0.6,0.55)
to (0.6,1.5);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.9,1.4) {$X$}
node at (-0.35,1.4) {$Y$}
node at (0.35,1.2) {$Z$}
node at (0.75,1.4) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.7,0.8) {};
\node[arrow box] (b) at (0,0.8) {};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.7,1.2);
\draw (c) to (b);
\draw (b) to (0,1.2);
\draw (c) to[out=15,in=-90] (0.7,0.6)
to (0.7,1.2);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.35) {$X$}
node at (0,1.35) {$Y$}
node at (0.7,1.35) {$W$};
\end{ctikzpicture}
\quad,
\]
by Proposition~\ref{prop:disint-identitiy}.\ref{propen:disint-marg}.
Thus $\cind{X}{Y}{W}$.
Similarly we prove $\cind{X}{Z}{W}$.
Finally, we prove \ref{propen:weakunion} and \ref{propen:contr} at the same time.
Note that $\cind{X}{Y\otimes Z}{W}$ implies $\cind{X}{Z}{W}$, as shown above.
Therefore what we need to prove is that
$\cind{X}{Y\otimes Z}{W}$ if and only if $\cind{X}{Y}{Z\otimes W}$,
under $\cind{X}{Z}{W}$.
Assume $\cind{X}{Z}{W}$, so we have
\[
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {\;\;\;\;\;\;\;};
\draw (a) to (0,1);
\draw (0.25,0) to ([xshiftu=0.25]a.south);
\draw (-0.25,0) to ([xshiftu=-0.25]a.south);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0,1.2) {$X$}
node at (-0.25,-0.2) {$Z$}
node at (0.25,-0.2) {$W$};
\end{ctikzpicture}
\;\;\equpto\;\;
\begin{ctikzpicture}[font=\small]
\node[arrow box] (a) at (0,0.5) {};
\node[discarder] (d) at (-0.6,0.4) {};
\draw (a) to (0,1);
\draw (0,0) to (a);
\draw (-0.6,0) to (d);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (0,1.2) {$X$}
node at (-0.6,-0.2) {$Z$}
node at (0,-0.2) {$W$};
\end{ctikzpicture}
\]
Then
\begin{align*}
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\node[copier] (c) at (-0.2,0.15) {};
\node[copier] (c2) at (0.2,0.15) {};
\node[arrow box] (a) at (-0.8,1) {\;\;\;\;\;};
\node[arrow box] (b) at (0,1) {\;\;\;\;\;};
\draw (omega) ++ (-0.2,0) to (c);
\draw (c) to[out=165,in=-90] ([xshiftu=-0.2]a.south);
\draw (a) to (-0.8,1.4);
\draw (c) to ([xshiftu=-0.2]b.south);
\draw (b) to (0,1.4);
\draw (c) to[out=15,in=-90] (0.5,0.8)
to (0.5,1.4);
\draw (omega) ++ (0.2,0) to (c2);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.2]a.south);
\draw (c2) to ([xshiftu=0.2]b.south);
\draw (c2) to[out=15,in=-90] (0.9,0.8)
to (0.9,1.4);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.8,1.55) {$X$}
node at (0,1.55) {$Y$}
node at (0.5,1.55) {$Z$}
node at (0.9,1.55) {$W$};
\end{ctikzpicture}
&\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\node[copier] (c) at (-0.2,0.15) {};
\node[copier] (c2) at (0.2,0.15) {};
\node[arrow box] (a) at (-0.7,1) {};
\node[arrow box] (b) at (0,1) {\;\;\;\;\;};
\node[discarder] (d) at (-1.25,0.85) {};
\draw (omega) ++ (-0.2,0) to (c);
\draw (c) to[out=165,in=-90] (d);
\draw (a) to (-0.7,1.4);
\draw (c) to ([xshiftu=-0.2]b.south);
\draw (b) to (0,1.4);
\draw (c) to[out=15,in=-90] (0.5,0.8)
to (0.5,1.4);
\draw (omega) ++ (0.2,0) to (c2);
\draw (c2) to[out=165,in=-90] (a.south);
\draw (c2) to ([xshiftu=0.2]b.south);
\draw (c2) to[out=15,in=-90] (0.9,0.8)
to (0.9,1.4);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.7,1.55) {$X$}
node at (0,1.55) {$Y$}
node at (0.5,1.55) {$Z$}
node at (0.9,1.55) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;};
\node[copier] (c) at (-0.2,0.15) {};
\node[copier] (c2) at (0.2,0.15) {};
\node[arrow box] (a) at (-0.9,1.5) {};
\node[arrow box] (b) at (-0.35,0.65) {\;\;\;\;\;};
\node[copier] (c3) at (0.45,0.95) {};
\draw (omega) ++ (-0.2,0) to (c);
\draw (a) to (-0.9,1.85);
\draw (c) to[out=165,in=-90] ([xshiftu=-0.2]b.south);
\draw (b) to (-0.35,1.85);
\draw (c) to[out=15,in=-90] (0.15,0.45)
to (0.15,1.85);
\draw (omega) ++ (0.2,0) to (c2);
\draw (c2) to[out=165,in=-90] ([xshiftu=0.2]b.south);
\draw (c2) to[out=15,in=-90] (0.45,0.45)
to (c3);
\draw (c3) .. controls (-0.5,1.1) and (-0.9,1.1) .. (a.south);
\draw (c3) to[out=60,in=-90] (0.65,1.85);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.9,2) {$X$}
node at (-0.35,2) {$Y$}
node at (0.15,2) {$Z$}
node at (0.65,2) {$W$};
\end{ctikzpicture}
\\
&\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;\;\;\;\;\;};
\node[arrow box] (a) at (-0.9,0.85) {};
\node[copier] (c3) at (0.4,0.25) {};
\draw (omega) ++ (-0.4,0) to (-0.4,1.2);
\draw (omega) to (0,1.2);
\draw (omega) ++ (0.4,0) to (c3);
\draw (a) to (-0.9,1.2);
\draw (c3) .. controls (-0.65,0.4) and (-0.9,0.4) .. (a.south);
\draw (c3) to[out=30,in=-90] (0.55,0.55) to (0.55,1.2);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.9,1.35) {$X$}
node at (-0.4,1.35) {$Y$}
node at (0,1.35) {$Z$}
node at (0.55,1.35) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0.1,-0.8) {};
\node[arrow box] (b) at (-0.2,-0.1) {\;\;\;\;\;\;};
\node[arrow box] (a) at (-0.9,0.85) {};
\node[copier] (c3) at (0.4,0.25) {};
\node[copier] (c) at (0.1,-0.6) {};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (b);
\draw (c) to[out=15,in=-90] (0.4,-0.3) to (c3);
\draw (a) to (-0.9,1.2);
\draw (c3) .. controls (-0.65,0.4) and (-0.9,0.4) .. (a.south);
\draw (c3) to[out=30,in=-90] (0.55,0.55) to (0.55,1.2);
\draw (b.north) ++(-0.2,0) to (-0.4,1.2);
\draw (b.north) ++(0.2,0) to (0,1.2);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.9,1.35) {$X$}
node at (-0.4,1.35) {$Y$}
node at (0,1.35) {$Z$}
node at (0.55,1.35) {$W$};
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state] (omega) at (0,0) {};
\node[copier] (c) at (0,0.2) {};
\node[arrow box] (a) at (-0.75,0.8) {};
\node[arrow box] (b) at (0,0.8) {\;\;\;\;\;};
\draw (omega) to (c);
\draw (c) to[out=165,in=-90] (a);
\draw (a) to (-0.75,1.3);
\draw (c) to (b);
\draw ([xshiftu=-0.2]b.north) to (-0.2,1.3);
\draw ([xshiftu=0.2]b.north) to (0.2,1.3);
\draw (c) to[out=15,in=-90] (0.6,0.55)
to (0.6,1.3);
\path[font=\normalsize,
execute at begin node=\everymath{\scriptstyle}]
node at (-0.75,1.45) {$X$}
node at (-0.2,1.45) {$Y$}
node at (0.2,1.45) {$Z$}
node at (0.6,1.45) {$W$};
\end{ctikzpicture}
\end{align*}
This proves $\cind{X}{Y\otimes Z}{W}$ if and only if $\cind{X}{Y}{Z\otimes W}$.
\end{proof}
The four properties from the graphoid axioms
are essential in reasoning of conditional independence
with DAGs or Bayesian networks~\cite{VermaP1988,GeigerVP1990}.
Conditional independence has been studied categorically
in~\cite{Simpson2017}. There, a categorical notion of
\emph{(conditional) independence structure} is introduced,
generalising algebraic axiomatisations of conditional independence,
such as with graphoids and separoids~\cite{Dawid2001}. We leave it to
future work to precisely relate our approach to conditional
probability to Simpson's categorical framework.
\section{Beyond causal channels}\label{sec:beyondcausal}
\tikzextname{s_beyond_causal}
All CD-categories $\catC$ that we have considered so far are affine in
the sense that all arrows $f\colon X\to Y$ are causal: $\ground\circ
f=\ground$. We now drop the affineness, in order to enlarge our
category to include `non-causal' arrows,
which enables us to have new notions such as scalars and effects.
Essentially, we lose nothing
by this change: all the arguments so far can still be applied to the
subcategory $\Caus(\catC)\subseteq\catC$ containing all the objects
and causal arrows. The category $\Caus(\catC)$ is an affine CD-category,
inheriting the monoidal
structure $(\otimes,I)$
and the comonoid structures $(\copier,\ground)$
from $\catC$.
Recall that \emph{channels} in $\catC$
are causal arrows, \textit{i.e.}\ arrows in $\Caus(\catC)$.
\emph{States} are channels of the form $\sigma\colon I\to X$.
We call endomaps $I\to I$ on the tensor
unit \emph{scalars}. The set $\catC(I,I)$ of scalars forms a monoid
via the composition $s\cdot t=s\circ t$ and $1=\id_I$. The
monoid of scalars is always commutative
--- in fact, this is the case for
any monoidal category, see \textit{e.g.}~\cite[\S3.2]{AbramskyC2009}.
In string diagram scalars are written as
$\vcenter{\hbox{\begin{tikzpicture}[font=\small] \node[scalar] (s) at
(-1,0.6) {$s$};
\end{tikzpicture}}}$ or simply as $s$.
We can multiply scalars $s$ to any arrows $f\colon X\to Y$
by the parallel composition, or
diagrammatically by juxtaposition:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$f$};
\node[scalar] at (-0.6,0) {$s$};
\draw (c) -- (0,0.7);
\draw (c) -- (0,-0.7);
\end{tikzpicture}}}
\]
We call an arrow $\sigma\colon I\to X$ is \emph{normalisable} if the
scalar $\ground \circ \sigma\colon I\to I$ is (multiplicatively)
invertible. In that case we can normalise $\sigma$ into a proper
state as follows.
\[
\nrm(\sigma)\coloneqq
\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (s) at (-1.45,0) {$\sigma$};
\node[discarder] (d) at ([yshiftu=0.2]s) {};
\node[state] (s2) at (0,0) {$\sigma$};
\draw (s) -- (d);
\draw (s2) -- +(0,0.5);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-2,-0.1) node {$\biggl($}
(-0.75,-0.1) node {$\biggr)^{\!\!-1}$};
\end{tikzpicture}}}
\]
\emph{Effects} in $\catC$ are arrows of the form $p\colon X\to I$;
they correspond to observables, with predicates as special case.
Diagrammatically they are written as on the left below.
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (p) at (0,0) {$p$};
\coordinate (X) at (0,-0.4);
\draw (X) to (p);
\end{tikzpicture}}}
\qquad\qquad\qquad\qquad
\sigma\models p
\;\coloneqq\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (s) at (0,0) {$\sigma$};
\node[state,hflip] (p) at (0,0.2) {$p$};
\draw (s) to (p);
\end{tikzpicture}}}
\]
On the right
the \emph{validity} $\sigma\models p$
of a state $\sigma\colon I\to X$ and a effect $p\colon X\to I$
is defined. It is the scalar given by composition.
Note that effects are not causal in general;
by definition, only discarders $\ground$ are causal ones.
States $\sigma\colon I\to X$ can be \emph{conditioned}
by effects $p\colon X\to I$ via normalisation, as follows.
\[
\sigma|_{p}
\coloneqq
\nrm
\Biggl(\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[state,hflip] (p) at (-0.4,0.6) {$p$};
\coordinate (X) at (0.4,1.3) {};
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90] (p);
\draw (copier) to[out=30,in=-90] (X);
\end{tikzpicture}}}
\;\;\Biggr)
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (s) at (-1.82,0.19) {$\sigma$};
\node[state,hflip] (p) at ([yshiftu=0.2]s) {$p$};
\draw (s) -- (p);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-2.37,0.29) node {$\Biggl($}
(-1.12,0.29) node {$\Biggr)^{\!\!-1}$};
\node[state] (omega) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.3) {};
\node[state,hflip] (p) at (-0.4,0.6) {$p$};
\coordinate (X) at (0.4,1.3) {};
\draw (omega) to (copier);
\draw (copier) to[out=165,in=-90] (p);
\draw (copier) to[out=30,in=-90] (X);
\end{tikzpicture}}}
\]
The conditional state $\sigma|_p$ is defined if
the validity $\sigma\models p$ is invertible.
Conditioning $\sigma|_p$ generalises
conditional probability $\Pr(A|B)$
given \emph{event} $B$,
see Example~\ref{ex:CD-cat} below.
At the end of the section
we will explain how conditioning
and disintegration are related.
Recall, from Examples~\ref{ex:KlD} and~\ref{ex:KlG},
that our previous examples $\Kl(\Dst)$ and $\Kl(\Giry)$
are both affine.
We give two non-affine CD-categories that have
$\Kl(\Dst)$ and $\Kl(\Giry)$ as subcategories, respectively.
\begin{example}
For discrete probability,
we use
\emph{multisets} (or \emph{unnormalised distributions}) over
nonnegative real numbers $\pRR=[0,\infty)$,
such as
\[
1\ket{x}+ 0.5\ket{y} + 3\ket{z}
\qquad
\text{on a set}
\;
X=\{x,y,z,\dotsc\}
\]
We denote by $\Mlt(X)$
the set of multisets over $\pRR$ on $X$.
More formally:
\[
\Mlt(X)
=\set{
\phi\colon X\to \pRR
| \text{$\phi$ has finite support}}
\enspace.
\]
It extends to a commutative monad $\Mlt\colon \Set\to\Set$,
see~\cite{CoumansJ13}.
In a similar way to the distribution monad $\Dst$,
we can check that the Kleisli category $\Kl(\Mlt)$ is a CD-category.
For a Kleisli map $f\colon X\to\Mlt(Y)$,
causality $\ground\circ f=\ground$ amounts to
the condition $\sum_y f(x)(y)=1$ for all $x\in X$.
It is thus easy to see that $\Caus(\Kl(\Mlt))\cong \Kl(\Dst)$.
In fact, the distribution monad $\Dst$ can be obtained
from $\Mlt$ as its \emph{affine submonad}, see~\cite{Jacobs17}.
An effect $p\colon X \rightarrow 1$ in $\Kl(\Mlt)$ is a function $p
\colon X \rightarrow \pRR$. Its validity $\sigma\models p$ in a state
$\omega$ is given by the expected value $\sum_{x}\sigma(x)\cdot
p(x)$. The state $\sigma|_{p}$ updated with `evidence' $p$ is defined
as $\sigma|_{p}(x) = \frac{\sigma(x)\cdot p(x)}{\sigma\models p}$.
\end{example}
\begin{example}
\label{ex:CD-cat}
For general, measure-theoretic probability,
we use \emph{s-finite kernels} between measurable spaces
\cite{Kallenberg2017,Staton2017}.
Let $X$ and $Y$ be measurable spaces.
A function $f\colon X\times \Sigma_Y\to[0,\infty]$
is called a \emph{kernel} from $X$ to $Y$ if
\begin{itemize}
\item $f(x,-)\colon \Sigma_Y\to [0,\infty]$ is a measure for each $X$; and
\item $f(-,B)\colon X\to [0,\infty]$ is measurable\footnote{The $\sigma$-algebra on $[0,\infty]$
is the standard one generated by
$\set{\infty}$ and measurable subsets of $\pRR$.
} for each $B\in\Sigma_Y$.
\end{itemize}
We write $f\colon X\krnto Y$ when $f$ is a kernel from $X$ to $Y$.
A \emph{probability kernel} is a kernel $f\colon X\krnto Y$
with $f(x,Y)=1$ for all $x\in X$.
A kernel $f\colon X\krnto Y$ is \emph{finite} if
there exists $r\in[0,\infty)$ such that for all $x\in X$, $f(x,Y)\le r$.
(Note that it must be `uniformly' finite.)
A kernel $f\colon X\krnto Y$ is \emph{s-finite} if
$f=\sum_n f_n$ for some countable family $(f_n\colon X\to Y)_{n\in\NN}$ of finite kernels.
For two s-finite kernels $f\colon X\krnto Y$
and $g\colon Y\krnto Z$, we define the (sequential) composite
$g\circ f\colon X\krnto Z$
by
\[
(g\circ f)(x,C)=\int_Y g(y,C) \, f(x,\dd y)
\]
for $x\in X$ and $C\in\Sigma_Z$.
There are identity kernels $\eta_X\colon X\krnto X$
given by $\eta_X(x,A)=\indic{A}(x)$.
With these data, measurable spaces and s-finite kernels form a category,
which we denote by $\sfKrn$.
There is a monoidal structure on $\sfKrn$.
For measurable spaces $X,Y$ we define
the tensor product $X\otimes Y=X\times Y$ to be the cartesian product of measurable spaces.
The tensor unit $I=1$ is the singleton space.
For s-finite kernels $f\colon X\krnto Y$ and $g\colon Z\krnto W$,
we define $f\otimes g\colon X\times Z\krnto Y\times W$ by
\begin{align*}
(f\otimes g)((x,z),E)
&=
\int_{Y}
\paren[\Big]{
\int_{W}
\indic{E}(y,w)
\,g(z,\dd w)
}
f(x,\dd y)
\\
&=
\int_{W}
\paren[\Big]{
\int_{Y}
\indic{E}(y,w)
\,f(x,\dd y)
}
g(z,\dd w)
\end{align*}
for $x\in X, z\in Z, E\in\Sigma_{Y\times W}$. The latter equality
holds by the Fubini-Tonelli theorem for s-finite measures. These make
the category $\sfKrn$ symmetric monoidal. Finally, for each
measurable space $X$ there is a `copier' $\copier\colon X\krnto
X\times X$ and a `discarder' $\ground\colon X\krnto 1$, given by
$\copier(x, E)=\indic{E}(x,x)$ and $\ground(x, 1)=1$,
so that $\sfKrn$ is a CD-category.
For more technical details we refer to \cite{Kallenberg2017,Staton2017}.
Note that an s-finite kernel $f\colon X\krnto Y$ is causal
if and only if it is a probability kernel,
which is nothing but a Kleisli map $X\to \Giry(Y)$ for the Giry monad.
Therefore the causal subcategory of $\sfKrn$ is the Kleisli category
of the Giry monad: $\Caus(\sfKrn)\cong \Kl(\Giry)$.
In particular, states in $\sfKrn$ are probability measures $\sigma\in\Giry(X)$.
An effect $p\colon X\krnto 1$ in $\sfKrn$,
\textit{i.e.}\ an s-finite kernel $p\colon X\times \Sigma_1\to [0,\infty]$,
can be identified with a measurable function $p\colon X\to [0,\infty]$.
The validity $\sigma\models p$ is then the integral $\int_X p(x)\,\sigma(\dd x)$,
defined in $[0,\infty]$.
The conditional state $\sigma|_{p}\in\Giry(X)$ is defined by:
\[
\sigma|_{p}(A) = \frac{\int_A p(x)\,\sigma(\dd x)}{\sigma\models p}
\]
for $A\in\Sigma_X$, when
the validity $\sigma\models p$ is neither $0$ nor $\infty$.
In particular, for any `event' $B\in \Sigma_X$,
the obvious
indicator function $\indic{B}\colon X\to [0,\infty]$
is an effect.
Then conditioning yields a new state
on $X$:
\[
\sigma|_{\indic{B}}(A)
= \frac{\int_A \indic{B}(x)\,\sigma(\dd x)}{\sigma\models \indic{B}}
= \frac{\sigma(A\cap B)}{\sigma(B)}
\quad
\text{for $A\in\Sigma_X$.}
\]
This amounts to
conditional probability $\Pr(A|B)=\Pr(A,B)/\Pr(B)$
given event $B$.
\end{example}
We need to generalise definitions
from the previous sections
in the non-affine/causal setting.
Here we make only a minimal generalisation
that is required in the next section.
For example, we still restrict ourselves to
disintegration of (causal) states,
although in the literature,
the notion of disintegration exists
also for non-probability (i.e.\ non-causal)
measures and even for non-finite measures,
see e.g.\ \cite[Definition~1]{ChangP1997}.
We leave such generalisations to future work.
Let $\sigma\colon I\to X$ be a state.
We define $\sigma$-almost equality
$f\equpto[\sigma]g$ between
arbitrary arrows $f,g\colon X\to Y$
in the same way as Definition~\ref{def:almost-equal}.
Similarly,
strong $\sigma$-almost equality
between arbitrary arrows
is defined as in Definition~\ref{def:str-almost-eq}
(here $\omega$ still ranges over states).
Disintegrations of a joint state $\omega\colon I\to X\otimes Y$
are defined as in Definition~\ref{def:disintegration},
except that an arrow $c_1\colon X\to Y$ (or $c_2\colon Y\to X$)
is not necessarily causal.
Nevertheless,
disintegrations of a state
are \emph{almost causal} in the following sense.
\begin{definition}
Let $\sigma\colon I\to X$ be a state. We say that an arrow $c\colon
X\to Y$ is \emph{$\sigma$-almost causal} if $\ground\circ
c\equpto[\sigma]\ground$.
\end{definition}
\noindent
Then the following is immediate from the definition.
\begin{proposition}
Let $c_1\colon X\to Y$ be a disintegration
of a state $\omega\colon I\to X\otimes Y$.
Then $c_1$ is $\omega_1$-almost causal,
where $\omega_1\colon I\to X$ is
the first marginal of $\omega$.
\qed
\end{proposition}
\begin{example}
In $\sfKrn$,
a s-finite kernel $f\colon X\krnto Y$
is $\sigma$-almost causal if and only if
$f(x,Y)=1$ for $\sigma$-almost all $x\in X$.
In that case, we can find
a probability kernel $f'\colon X\krnto Y$
such that $f\equpto[\sigma]f'$,
by tweaking $f$ in the obvious way.
From this it follows that
a disintegration of
a joint probability measure $\omega\in\Giry(X\times Y)$
exists in $\sfKrn$
if and only if it exists in $\Kl(\Giry)$.
By Proposition~\ref{prop:KlG-eq-str},
we can strengthen almost equality between
channels in $\sfKrn$.
It is easy to see that
equality strengthening is valid also for
almost causal maps:
if $f,g\colon X\krnto Y$
are $\sigma$-almost causal maps
with $f\equpto[\sigma] g$,
then $f,g$ are strongly $\sigma$-almost equal.
(It is not clear whether equality strengthening
is valid for arbitrary maps in $\sfKrn$,
but we will not need such a general result in this paper.)
\end{example}
In the remainder of the section,
we present a basic relationship
between disintegration
and conditioning~$\sigma|_p$,
introduced above.
We assume a
joint state $\omega$ with its two disintegrations $c_{1}$ and $c_{2}$ in:
\begin{equation}
\label{eqn:disintegrationforcrossover}
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0.25,0) {$\;\omega\;$};
\node[copier] (copier) at (0,0.4) {};
\node[arrow box] (c) at (0.5,0.95) {$c_1$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\coordinate (omega1) at ([xshiftu=-0.25]omega);
\coordinate (omega2) at ([xshiftu=0.25]omega);
\node[discarder] (d) at ([yshiftu=0.2]omega2) {};
\draw (omega1) to (copier);
\draw (omega2) to (d);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (Y);
\path[scriptstyle]
node at (-0.65,1.5) {$X$}
node at (0.65,1.5) {$Y$};
\end{tikzpicture}}}
\qquad=\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {\;$\omega$\;};
\coordinate (X) at (-0.25,0.55) {};
\coordinate (Y) at (0.25,0.55) {};
\draw (omega) ++(-0.25, 0) to (X);
\draw (omega) ++(0.25, 0) to (Y);
\path[scriptstyle]
node at (-0.4,0.55) {$X$}
node at (0.4,0.55) {$Y$};
\end{tikzpicture}}}
\qquad=\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (-0.25,0) {$\;\omega\;$};
\coordinate (omegaX) at ([xshiftu=-0.25]omega);
\coordinate (omegaY) at ([xshiftu=0.25]omega);
\node[discarder] (d) at ([yshiftu=0.2]omegaX) {};
\node[copier] (copier) at (0,0.4) {};
\node[arrow box] (c) at (-0.5,0.95) {$c_2$};
\coordinate (X) at (-0.5,1.5);
\coordinate (Y) at (0.5,1.5);
\draw (omegaX) to (d);
\draw (omegaY) to (copier);
\draw (copier) to[out=165,in=-90] (c);
\draw (copier) to[out=30,in=-90] (Y);
\draw (c) to (X);
\path[scriptstyle]
node at (-0.65,1.5) {$X$}
node at (0.65,1.5) {$Y$};
\end{tikzpicture}}}
\end{equation}
\noindent We write $\omega_{1}$ and $\omega_{2}$ for the first
and second marginals of $\omega$.
(Thus the equations~\eqref{eqn:disintegrationforcrossover} above
are the same as \eqref{eqn:disintegrations}.)
Let $q$ be an effect on $Y$. It can be extended to an effect
$\one\otimes q$ on $X\otimes Y$, where:
\[
\one\otimes q
\quad\coloneqq\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (d) at (-0.8,0) {};
\node[state,hflip] (q) at (0,0) {$q$};
\coordinate (X) at (-0.8,-0.3);
\coordinate (Y) at (0,-0.3);
\draw (X) to (d);
\draw (Y) to (q);
\path[scriptstyle]
node at (-0.65,-0.3) {$X$}
node at (0.15,-0.3) {$Y$};
\end{tikzpicture}}}
\]
\noindent Then we can form the conditioned state
$\omega|_{\one\otimes q}$. In a next step we take its first marginal,
written as $\big(\omega|_{\one\otimes q}\big)_{1}$. It turns out that,
in general, this first marginal is different from the original first
marginal $\omega_{1}$, even though the effect $q$ only applies to
the second coordinate. This is called `crossover influence'
in~\cite{JacobsZ17}. It happens when the state $\omega$ is
`entwined', that is, when its two coordinates are correlated.
A fundamental result in this context is that this crossover influence
can also be captured via the channels $c_{1}, c_{2}$ that are
extracted from $\omega$ via disintegrations. This works via effect
transformation $c^*(p)\coloneqq p\circ c$ and
state transformation $c_{*}(\sigma)\coloneqq c\circ\sigma$
along a channel.
\begin{theorem}
\label{thm:crossover}
In the above setting, assuming that the relevant conditioned states exist,
there are equalities of states:
\begin{equation}
\label{eqn:crossover}
\begin{array}{rcccl}
\omega_{1}|_{c_{1}^{*}(q)}
& = &
\big(\omega|_{\one\otimes q}\big)_{1}
& = &
\big(c_{2}\big)_{*}(\omega_{2}|_{q}).
\end{array}
\end{equation}
\end{theorem}
Following~\cite{JacobsZ16} we can say that the expression on the left
in~\eqref{eqn:crossover} uses \emph{backward} inference, and the one
on the right uses \emph{forward} inference.
\begin{proof}
We first note that the state in the middle of~\eqref{eqn:crossover}
is the first marginal of:
\[ \vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (oma) at (-2,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (oma1) at ([xshiftu=-0.4]oma);
\coordinate (oma2) at ([xshiftu=0.4]oma);
\node[discarder] (1a) at ([yshiftu=0.2]oma1) {};
\node[state,hflip,scale=0.75] (qa) at ([yshiftu=0.2]oma2) {$q$};
\draw (oma1) -- (1a);
\draw (oma2) -- (qa);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-2.9,0) node {$\Biggl($}
(-1,0) node {$\Biggr)^{\!\!-1}$};
\node[state] (omb) at (0.5,0) {$\hspace*{0.5em}\omega\hspace*{0.5em}$};
\coordinate (ombX) at ([xshiftu=-0.5]omb);
\coordinate (ombY) at ([xshiftu=0.5]omb);
\node[copier] (copierX) at ([yshiftu=0.2]ombX) {};
\node[copier] (copierY) at ([yshiftu=0.2]ombY) {};
\node[discarder] (1b) at ([xshiftu=-0.3,yshiftu=0.2]copierX) {};
\node[state,hflip,scale=0.75] (qb) at ([xshiftu=-0.3,yshiftu=0.2]copierY) {$q$};
\coordinate (X) at ([xshiftu=0.3,yshiftu=1.0]copierX) {};
\coordinate (Y) at ([xshiftu=0.3,yshiftu=1.0]copierY) {};
\draw (ombX) to (copierX);
\draw (ombY) to (copierY);
\draw (copierX) to[out=165,in=-90] (1b);
\draw (copierX) to[out=30,in=-90] (X);
\draw (copierY) to[out=165,in=-90] (qb);
\draw (copierY) to[out=30,in=-90] (Y);
\end{tikzpicture}}}
\]
\noindent Hence:
\begin{equation}
\label{eqn:crossover1}
\big(\omega|_{\one\otimes q}\big)_{1}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (oma) at (-2,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (oma1) at ([xshiftu=-0.4]oma);
\coordinate (oma2) at ([xshiftu=0.4]oma);
\node[discarder] (1a) at ([yshiftu=0.2]oma1) {};
\node[state,hflip,scale=0.75] (qa) at ([yshiftu=0.2]oma2) {$q$};
\draw (oma1) -- (1a);
\draw (oma2) -- (qa);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-2.9,0) node {$\Biggl($}
(-1,0) node {$\Biggr)^{\!\!-1}$};
\node[state] (omb) at (0.0,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (ombX) at ([xshiftu=-0.4]omb);
\coordinate (ombY) at ([xshiftu=0.4]omb);
\node[state,hflip,scale=0.75] (qb) at ([yshiftu=0.2]ombY) {$q$};
\coordinate (X) at ([yshiftu=0.6]ombX) {};
\draw (ombX) to (X);
\draw (ombY) to (qb);
\end{tikzpicture}}}
\end{equation}
\noindent We note that the above scalar (that is inverted) can also be
obtained as:
\begin{equation}
\label{eqn:crossover2}
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (omegaX) at ([xshiftu=-0.4]omega);
\coordinate (omegaY) at ([xshiftu=0.4]omega);
\node[arrow box] (c) at ([yshiftu=0.5]omegaX) {$c_1$};
\node[discarder] (d) at ([yshiftu=0.2]omegaY) {};
\node[state,hflip,scale=0.75] (q) at ([yshiftu=0.5]c) {$q$};
\draw (omegaX) to (c);
\draw (omegaY) to (d);
\draw (c) to (q);
\end{tikzpicture}}}
\quad
=
\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (0,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (omegaX) at ([xshiftu=-0.4]omega);
\coordinate (omegaY) at ([xshiftu=0.4]omega);
\node[copier] (copier) at ([yshiftu=0.3]omegaX) {};
\node[arrow box] (c) at ([xshiftu=-0.0,yshiftu=1.0]omegaY) {$c_1$};
\node[discarder] (dX) at ([yshiftu=1.5]omegaX) {};
\node[discarder] (dY) at ([yshiftu=0.2]omegaY) {};
\node[state,hflip,scale=0.75] (q) at ([yshiftu=0.5]c) {$q$};
\draw (omegaX) to (copier);
\draw (omegaY) to (dY);
\draw (copier) to[out=150,in=-90] (dX);
\draw (copier) to[out=15,in=-90] (c);
\draw (c) to (q);
\end{tikzpicture}}}
\quad
\smash{\stackrel{\eqref{eqn:disintegrationforcrossover}}{=}}
\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (-2,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (omegaX) at ([xshiftu=-0.4]omega);
\coordinate (omegaY) at ([xshiftu=0.4]omega);
\node[discarder] (dX) at ([yshiftu=0.2]omegaX) {};
\node[state,hflip,scale=0.75] (q) at ([yshiftu=0.2]omegaY) {$q$};
\draw (omegaX) -- (dX);
\draw (omegaY) -- (q);
\end{tikzpicture}}}
\end{equation}
\noindent Hence we can prove the equation on the left
in~\eqref{eqn:crossover}:
\[
\omega_{1}|_{c_{1}^{*}(q)}
\;\;
=
\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (omega) at (-2,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (omegaX) at ([xshiftu=-0.4]omega);
\coordinate (omegaY) at ([xshiftu=0.4]omega);
\node[arrow box] (c) at ([yshiftu=0.5]omegaX) {$c_1$};
\node[discarder] (d) at ([yshiftu=0.2]omegaY) {};
\node[state,hflip,scale=0.75] (q) at ([yshiftu=0.5]c) {$q$};
\draw (omegaX) to (c);
\draw (omegaY) to (d);
\draw (c) to (q);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-3.0,0.4) node {$\Biggl($}
(-1,0.4) node {$\Biggr)^{\!\!-1}$};
\node[state] (omegab) at (0.2,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (omegabX) at ([xshiftu=-0.4]omegab);
\coordinate (omegabY) at ([xshiftu=0.4]omegab);
\node[copier] (copier) at ([yshiftu=0.3]omegabX) {};
\node[arrow box] (cb) at ([xshiftu=-0.2,yshiftu=0.9]omegabY) {$c_1$};
\node[discarder] (dY) at ([yshiftu=0.2]omegabY) {};
\node[state,hflip,scale=0.75] (qb) at ([yshiftu=0.5]cb) {$q$};
\coordinate (X) at ([yshiftu=1.5]omegabX) {};
\draw (omegabX) to (copier);
\draw (omegabY) to (dY);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=15,in=-90] (cb);
\draw (cb) to (qb);
\end{tikzpicture}}}
\quad
\smash{\stackrel{\eqref{eqn:disintegrationforcrossover},\eqref{eqn:crossover2}}{=}}
\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (oma) at (-2,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (oma1) at ([xshiftu=-0.4]oma);
\coordinate (oma2) at ([xshiftu=0.4]oma);
\node[discarder] (1a) at ([yshiftu=0.2]oma1) {};
\node[state,hflip,scale=0.75] (qa) at ([yshiftu=0.2]oma2) {$q$};
\draw (oma1) -- (1a);
\draw (oma2) -- (qa);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-2.9,0) node {$\Biggl($}
(-1,0) node {$\Biggr)^{\!\!-1}$};
\node[state] (omb) at (0.0,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (ombX) at ([xshiftu=-0.4]omb);
\coordinate (ombY) at ([xshiftu=0.4]omb);
\node[state,hflip,scale=0.75] (qb) at ([yshiftu=0.2]ombY) {$q$};
\coordinate (X) at ([yshiftu=0.6]ombX) {};
\draw (ombX) to (X);
\draw (ombY) to (qb);
\end{tikzpicture}}}
\]
\noindent In a similar way we prove the equation on the right
in~\eqref{eqn:crossover}, since $\big(c_{2}\big)_{*}(\omega_{2}|_{q})$ equals:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (oma) at (-2,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (omaX) at ([xshiftu=-0.4]oma);
\coordinate (omaY) at ([xshiftu=0.4]oma);
\node[discarder] (daX) at ([yshiftu=0.2]omaX) {};
\node[state,hflip,scale=0.75] (qa) at ([yshiftu=0.2]omaY) {$q$};
\draw (omaX) -- (daX);
\draw (omaY) -- (qa);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-2.9,0) node {$\Biggl($}
(-1,0) node {$\Biggr)^{\!\!-1}$};
\node[state] (omb) at (0.0,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (ombX) at ([xshiftu=-0.4]omb);
\coordinate (ombY) at ([xshiftu=0.4]omb);
\node[discarder] (dbX) at ([yshiftu=0.2]ombX) {};
\node[copier] (copier) at ([yshiftu=0.3]ombY) {};
\node[state,hflip,scale=0.75] (qb) at ([xshiftu=-0.3,yshiftu=0.6]ombY) {$q$};
\node[arrow box] (cb) at ([xshiftu=0.3,yshiftu=1.5]ombY) {$c_2$};
\coordinate (Y) at ([yshiftu=0.5]cb) {};
\draw (ombX) to (dbX);
\draw (ombY) to (copier);
\draw (copier) to[out=150,in=-90] (qb);
\draw (copier) to[out=15,in=-90] (cb);
\draw (cb) to (Y);
\end{tikzpicture}}}
\;
=
\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (oma) at (-2,0.5) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (omaX) at ([xshiftu=-0.4]oma);
\coordinate (omaY) at ([xshiftu=0.4]oma);
\node[discarder] (1a) at ([yshiftu=0.2]omaX) {};
\node[state,hflip,scale=0.75] (qa) at ([yshiftu=0.2]omaY) {$q$};
\draw (omaX) -- (1a);
\draw (omaY) -- (qa);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-2.9,0.5) node {$\Biggl($}
(-1,0.5) node {$\Biggr)^{\!\!-1}$};
\node[state] (omb) at (0.1,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (ombX) at ([xshiftu=-0.4]omb);
\coordinate (ombY) at ([xshiftu=0.4]omb);
\node[discarder] (dbX) at ([yshiftu=0.2]ombX) {};
\node[copier] (copier) at ([yshiftu=0.3]ombY) {};
\node[state,hflip,scale=0.75] (qb) at ([yshiftu=1.5]ombY) {$q$};
\node[arrow box] (cb) at ([yshiftu=1.1]ombX) {$c_2$};
\coordinate (Y) at ([yshiftu=0.7]cb) {};
\draw (ombX) to (dbX);
\draw (ombY) to (copier);
\draw (copier) to[out=150,in=-90] (cb);
\draw (copier) to[out=15,in=-90] (qb);
\draw (cb) to (Y);
\end{tikzpicture}}}
\;
\smash{\stackrel{\eqref{eqn:disintegrationforcrossover}}{=}}
\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (oma) at (-2,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (oma1) at ([xshiftu=-0.4]oma);
\coordinate (oma2) at ([xshiftu=0.4]oma);
\node[discarder] (1a) at ([yshiftu=0.2]oma1) {};
\node[state,hflip,scale=0.75] (qa) at ([yshiftu=0.2]oma2) {$q$};
\draw (oma1) -- (1a);
\draw (oma2) -- (qa);
\path[font=\normalsize,text height=1.5ex,text depth=0.25ex]
(-2.9,0) node {$\Biggl($}
(-1,0) node {$\Biggr)^{\!\!-1}$};
\node[state] (omb) at (-0.1,0) {$\hspace*{0.4em}\omega\hspace*{0.4em}$};
\coordinate (ombX) at ([xshiftu=-0.4]omb);
\coordinate (ombY) at ([xshiftu=0.4]omb);
\node[state,hflip,scale=0.75] (qb) at ([yshiftu=0.2]ombY) {$q$};
\coordinate (X) at ([yshiftu=0.6]ombX) {};
\draw (ombX) to (X);
\draw (ombY) to (qb);
\end{tikzpicture}}}
\]
\end{proof}
The two equations in Theorem~\ref{eqn:crossover} will be illustrated
in the `disease and mood' example below, where a particular state
(probability) will be calculated in three different ways. For a gentle
introduction to Bayesian inference with channels, and many more
examples, we refer to~\cite{JacobsZ18}.
\begin{remark}
Another way of relating conditioning
to disintegration / Bayesian inversion was pointed
out by a reviewer of the paper:
for a state $\sigma\colon I\to X$
and an effect $p\colon X\to I$,
a conditional state $\sigma|_p\colon I\to X$
is a Bayesian inversion for $\sigma$
along $p$.
This, however, involves disintegration of non-causal maps,
which we leave to future work.
\end{remark}
\subsection*{Disease and mood example}
We describe an example of probabilistic (Bayesian)
reasoning. The setting is the following. We consider a joint state
about the occurrence and non-occurrence of a disease, written as a
two-element set $D = \{d,\no{d}\}$, jointly with the occurrence and
non-occurrence of a good mood, written as $M = \{m, \no{m}\}$, where
$\no{m}$ stands for a bad (not good) mood. The joint distribution,
called $\omega\in \Dst(M\times D)$, that we start from is of the form:
\begin{equation}
\label{eqn:DMstate}
\begin{array}{rcl}
\omega
& = &
0.05\ket{m,d} + 0.4\ket{m,\no{d}} + 0.5\ket{\no{m},d} + 0.05\ket{\no{m},\no{d}}.
\end{array}
\end{equation}
\noindent Suppose there is a test for the disease with the following
sensitivity and specificity. It is positive in 90\% of all cases of
people having the disease, and also 5\% positive for people without
the disease. Suppose the disease comes out positive. What is then the
mood? It is expected that the mood will deteriorate, since the disease
and the mood are `entwined' (correlated) in the above joint
state~\eqref{eqn:DMstate}: a high likelihood of disease corresponds to
a low mood.
The test's sensitivity and specificity is expressed as a channel
$s\colon D\rightarrow 2$, where $2 = \{t,f\}$, with:
\[ \begin{array}{rclcrcl}
c(d)
& = &
\frac{9}{10}\ket{t} + \frac{1}{10}\ket{f}
& \qquad &
c(\no{d})
& = &
\frac{1}{20}\ket{t} + \frac{19}{20}\ket{f}.
\end{array} \]
\noindent We calculate the first and second marginal of $\omega$:
\[ \begin{array}{rccclcrcccl}
\omega_{1}
& \coloneqq &
\marg{\omega}{[1,0]}
& = &
0.45\ket{m} + 0.55\ket{\no{m}}
& \qquad &
\omega_{2}
& \coloneqq &
\marg{\omega}{[0,1]}
& = &
0.55\ket{d} + 0.45\ket{\no{d}}.
\end{array} \]
\noindent The a priori probability of a positive test is obtained by
state transformation, applied to the second marginal:
\[ \begin{array}{rcl}
s_{*}\big(\omega_{2}\big)
& = &
0.518\ket{t} + 0.482\ket{f}.
\end{array} \]
As explained above, we are interested in the mood after a positive
test. We write $\tt$ for the predicate on $2 = \{t,f\}$ given by
$\tt(t) = 1$ and $\tt(f) = 0$. We can transform it to a predicate
$s^{*}(\tt)$ on $D = \{d,\no{d}\}$, namely $s^{*}(\tt)(d) =
\frac{9}{10}$ and $s^{*}(\tt)(\no{d}) = \frac{1}{20}$. We now describe
three equivalent ways to calculate the posterior mood, as
in Theorem~\ref{thm:crossover}, with predicate $q = s^{*}(\tt)$.
\begin{enumerate}
\item First we use the truth predicate $\one$ on $M = \{m,\no{m}\}$,
which is always $1$, to extend (weaken) the predicate $s^{*}(\tt)$
on $D$ to $\one\otimes s^{*}(\tt)$ on $M\times D$. The latter
predicate can be used to update the joint state
$\omega\in\Dst(M\times D)$. If we then take the first marginal we
obtain the updated mood probability:
\[ \begin{array}{rcl}
\marg{\big(\omega\big|_{\one\otimes s^{*}(\tt)}\big)}{[1,0]}
& = &
0.126\ket{m} + 0.874\ket{\no{m}}.
\end{array} \]
\noindent Clearly, a positive test leads to a lower mood: a reduction
from $0.45$ to $0.126$.
\item Next we extract channels $c_{1} \colon M \rightarrow D$ and
$c_{2} \colon D \rightarrow M$ from $\omega$ via disintegration as
in~\eqref{eqn:disintegrationforcrossover}. For instance, $c_{1}$ is
defined as:
\[ \begin{array}{rcl}
c_{1}(m)
& = &
\frac{\omega(m,d)}{\omega_{1}(m)}\ket{d} +
\frac{\omega(m,\no{d})}{\omega_{1}(m)}\ket{\no{d}}
\hspace*{\arraycolsep}=\hspace*{\arraycolsep}
\frac{1}{9}\ket{d} + \frac{8}{9}\ket{\no{d}}
\\
c_{1}(\no{m})
& = &
\frac{\omega(\no{m},d)}{\omega_{1}(\no{m})}\ket{d} +
\frac{\omega(\no{m},\no{d})}{\omega_{1}(\no{m})}\ket{\no{d}}
\hspace*{\arraycolsep}=\hspace*{\arraycolsep}
\frac{10}{11}\ket{d} + \frac{1}{11}\ket{\no{d}}.
\end{array} \]
\noindent We can now transform the predicate $s^{*}(\tt)$ on $D$ along
$c_{1}$ to get the predicate $c_{1}^{*}(s^{*}(\tt)) = (s_{1} \klafter
c_{1})^{*}(\tt))$ on $M$ given by: $d \mapsto 13/90$ and $\no{d}
\mapsto 181/220$. We can now use this predicate to update the a priori
`mood' marginal $\omega_{1}\in\Dst(M)$. This gives the same a
posteriori outcome as before:
\[ \begin{array}{rcl}
\omega_{1}\big|_{c_{1}^{*}(s^{*}(\tt))}
& = &
0.126\ket{m} + 0.874\ket{\no{m}}.
\end{array} \]
\item We can also update the second `disease' marginal
$\omega_{2}\in\Dst(D)$ directly with the predicate $s^{*}(\tt)$ and
then do state transformation along the channel $c_{2} \colon
D\rightarrow M$. This gives the same updated mood:
\[ \begin{array}{rcl}
(c_{2})_{*}\big(\omega_{2}|_{s^{*}(\tt)}\big)
& = &
0.126\ket{m} + 0.874\ket{\no{m}}.
\end{array} \]
\end{enumerate}
\section{Disintegration via likelihoods}\label{sec:likelihood}
\tikzextname{s_disint_lik}
We continue in the setting of Section~\ref{sec:beyondcausal} in
a CD-category that is not necessarily affine.
The goal of this section is to present Theorem~\ref{thm:likelihood},
which generalises a construction of Bayesian inversions using
densities/likelihoods shown in Example~\ref{ex:inversion}.
We first introduce `likelihoods' in our setting.
\begin{definition}
\label{def:likelihood}
We say a channel $c\colon X\to Y$ is represented by a effect $\ell$ on
$X\otimes Y$ with respect to an arrow $\nu\colon I\to Y$ if
\begin{equation}
\label{eq:likelihood}
\begin{ctikzpicture}[font=\small]
\node[arrow box] (c) at (0,0) {$c$};
\draw (c) -- (0,0.7);
\draw (c) -- (0,-0.7);
\end{ctikzpicture}
\;\;=\;\;
\begin{ctikzpicture}[font=\small]
\node[state,hflip] (L) at (-1.1,0.5) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (-0.45,0.2) {};
\node[state] (tau) at (-0.45,0) {$\nu$};
\coordinate (Y) at (-0.1,1.2) {} {} {};
\coordinate (X) at (-1.4,-0.7) {} {};
\draw (X) to ([xshiftu=-.3]L);
\draw (tau) to (copier2);
\draw (copier2) to[out=165,in=-90] ([xshiftu=.3]L);
\draw (copier2) to[out=30,in=-90] (Y);
\end{ctikzpicture}
\end{equation}
We call $\ell$ a \emph{likelihood relation} for
the channel $c$ with respect to $\nu$.
\end{definition}
Interpreted in the category $\sfKrn$, the definition says:
a kernel $c\colon X\krnto Y$ satisfies
\[
c(x,B)
=\int_B \ell(x,y)\,\nu(\dd y)
\]
for a kernel $\ell\colon X\times Y\krnto 1$
(identified with a measurable function $\ell\colon X\times Y\to [0,\infty]$)
and a measure $\nu\colon 1\krnto Y$.
This is basically the same as what we have
in Example~\ref{ex:inversion}, but
here $\nu$ is not necessarily the Lebesgue measure.
\begin{definition}
Let $\sigma\colon I\to X$ be a state.
An effect $p\colon X\to I$ is
\emph{$\sigma$-almost invertible} if there is an effect $q\colon X\to
I$ such that:
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (p) at (-0.5,0.4) {$p$};
\node[state,hflip] (q) at (0.5,0.4) {$q$};
\node[copier] (copier) at (0,0) {};
\coordinate (X) at (0,-0.3);
\draw (X) to (copier);
\draw (copier) to[out=165,in=-90] (p);
\draw (copier) to[out=15,in=-90] (q);
\end{tikzpicture}}}
\quad\equpto[\sigma]\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (d) at (0,0.5) {};
\coordinate (X) at (0,0);
\draw (X) to (d);
\end{tikzpicture}}}
\enspace.
\]
\end{definition}
The definition allows us to normalise an arrow $f\colon X\to Y$
into an almost causal one, as follows.
If an effect $\ground\circ f$ is $\sigma$-almost inverted by $q$,
as on the left below,
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (p) at (-0.5,1.1) {};
\node[arrow box,anchor=south] (f) at (-0.5,0.4) {$f$};
\node[state,hflip] (q) at (0.5,0.4) {$q$};
\node[copier] (copier) at (0,0) {};
\coordinate (X) at (0,-0.3);
\draw (X) to (copier);
\draw (copier) to[out=165,in=-90] (f);
\draw (f) to (p);
\draw (copier) to[out=15,in=-90] (q);
\end{tikzpicture}}}
\quad\equpto[\sigma]\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[discarder] (d) at (0,0.5) {};
\coordinate (X) at (0,0);
\draw (X) to (d);
\end{tikzpicture}}}
\qquad\qquad\qquad\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\coordinate (Y) at (-0.5,1.2) {};
\node[arrow box,anchor=south] (f) at (-0.5,0.4) {$f$};
\node[state,hflip] (q) at (0.5,0.4) {$q$};
\node[copier] (copier) at (0,0) {};
\coordinate (X) at (0,-0.3);
\draw (X) to (copier);
\draw (copier) to[out=165,in=-90] (f);
\draw (f) to (Y);
\draw (copier) to[out=15,in=-90] (q);
\end{tikzpicture}}}
\]
then clearly
the arrow $X\to Y$ on the right is $\sigma$-almost causal.
We can now formulate and prove our main technical result.
\begin{theorem}
\label{thm:likelihood}
Let $\sigma$ be a state on $X$, and $c\colon X\to Y$
be a channel represented by a likelihood relation $\ell$ with respect to $\nu$
as in~\eqref{eq:likelihood} above.
Assume that the category admits equality strengthening
for almost causal maps,
and that the effect
\[
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (L) at (0,0) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (-0.7,-0.3) {};
\node[state] (tau) at (-0.7,-0.5) {$\sigma$};
\node[discarder] (Y) at (-1,0.5) {};
\coordinate (X) at (0.3,-1.2);
\draw (X) to ([xshiftu=.3]L);
\draw (tau) to (copier2);
\draw (copier2) to[out=15,in=-90] ([xshiftu=-.3]L);
\draw (copier2) to[out=150,in=-90] (Y);
\end{tikzpicture}}}
\quad=\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (L) at (0,0) {\;\,$\ell$\;\,};
\node[state] (tau) at (-0.3,-0.3) {$\sigma$};
\coordinate (X) at (0.3,-1.2);
\draw (X) to ([xshiftu=.3]L);
\draw (tau) to ([xshiftu=-.3]L);
\end{tikzpicture}}}
\qquad\text{is almost invertible w.r.t.}\quad
c_*(\sigma)
=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (L) at (-1.1,0.5) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (-0.4,0.2) {};
\node[state] (tau) at (-0.4,0) {$\nu$};
\node[state] (sigma) at (-1.4,0) {$\sigma$};
\coordinate (Y) at (-0.1,1.2);
\draw (sigma) to ([xshiftu=-.3]L);
\draw (tau) to (copier2);
\draw (copier2) to[out=165,in=-90] ([xshiftu=.3]L);
\draw (copier2) to[out=45,in=-90] (Y);
\end{tikzpicture}}}
\enspace.
\]
Then, writing $q\colon Y\to I$ for an almost inverse to the effect,
the channel
\[
d\colon Y\to X\;\;\coloneqq\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (L) at (0,0) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (-0.7,-0.3) {};
\node[state] (tau) at (-0.7,-0.5) {$\sigma$};
\coordinate (Y) at (-1,0.6);
\coordinate (X) at (0.75,-1.2);
\node[copier] (copierY) at (0.75,-0.6) {};
\node[state,hflip] (q) at (1.2,0) {$q$};
\draw (X) to (copierY);
\draw (copierY) to[out=150,in=-90] ([xshiftu=.3]L);
\draw (copierY) to[out=30,in=-90] (q);
\draw (tau) to (copier2);
\draw (copier2) to[out=15,in=-90] ([xshiftu=-.3]L);
\draw (copier2) to[out=150,in=-90] (Y);
\end{tikzpicture}}}
\]
is a Bayesian inversion for $\sigma$ along $c\colon X\to Y$. Namely,
together they satisfy the equation~\eqref{eq:bayesian-inversion}.
\end{theorem}
\begin{myproof}
We reason as follows.
\begin{align*}
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (sigma) at (0,0) {$\sigma$};
\node[arrow box] (tauL) at (0,0.48) {$c$};
\node[copier] (copier) at (0,1.04) {};
\node[arrow box] (sigmaL) at (-0.5,1.8) {$d$};
\coordinate (X) at (-0.5,2.3);
\coordinate (Y) at (0.4,2.3);
\draw (sigma) to (tauL);
\draw (tauL) to (copier);
\draw (copier) to[out=160,in=-90] (sigmaL);
\draw (sigmaL) to (X);
\draw (copier) to[out=30,in=-90] (Y);
\end{tikzpicture}}}
\;\;&=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (sigma) at (1.1,-3.9) {$\sigma$};
\node[copier] (copier) at (2.4,-2) {};
\coordinate (Y) at (3,-0.2) {};
\node[state,hflip] (L) at (1.4,-2.5) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (2.05,-2.9) {};
\node[state] (tau) at (2.05,-3.2) {$\nu$};
\node[copier] (copierY) at (1.7,-1.4) {};
\draw (copier) to[out=160,in=-90] (copierY);
\draw (copier) to[out=30,in=-90] (Y);
\draw (sigma) to ([xshiftu=-.3]L);
\draw (tau) to (copier2);
\draw (copier2) to[out=150,in=-90] ([xshiftu=.3]L);
\draw (copier2) to[out=30,in=-90] (copier);
\node[state,hflip] (L) at (0.95,-0.8) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (0.25,-1.1) {};
\node[state] (tau) at (0.25,-1.3) {$\sigma$};
\coordinate (X) at (-0.1,-0.2) {};
\node[state,hflip] (q) at (2.15,-0.8) {$q$};
\draw (copierY) to[out=150,in=-90] ([xshiftu=.3]L);
\draw (copierY) to[out=30,in=-90] (q);
\draw (tau) to (copier2);
\draw (copier2) to[out=15,in=-90] ([xshiftu=-.3]L);
\draw (copier2) to[out=150,in=-90] (X);
\end{tikzpicture}}}
\;\;\overset{(\mathrm{i})}{=}\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (sigma) at (-0.6,1.7) {$\sigma$};
\node[copier] (copier) at (0.6,-0.3) {};
\node[state,hflip] (q) at (0.85,1.95) {$q$};
\coordinate (X) at (-1.4,2.65) {} {} {} {} {} {} {} {};
\coordinate (Y) at (1.5,2.65) {} {} {} {} {} {} {} {};
\node[state,hflip] (L) at (-0.3,1.95) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (0.4,1.2) {};
\node[state] (tau) at (0.6,-0.5) {$\nu$};
\node[state,hflip] (L2) at (0,0) {\;\,$\ell$\;\,};
\node[state] (sigma2) at (-0.6,-0.5) {$\sigma$};
\node[copier] (copier3) at (0.9,0.6) {};
\node[copier] (copier4) at (-0.6,-0.3) {};
\draw (sigma) to ([xshiftu=-.3]L);
\draw (tau) to (copier);
\draw (copier2) to[out=150,in=-90] ([xshiftu=.3]L);
\draw (copier2) to[out=30,in=-90] (q);
\draw (sigma2) to (copier4);
\draw (copier4) to[out=135,in=-90] (X);
\draw (copier4) to[out=15,in=-90] ([xshiftu=-.3]L2);
\draw (copier) to[out=165,in=-90] ([xshiftu=.3]L2);
\draw (copier) to[out=30,in=-90] (copier3);
\draw (copier3) to[out=165,in=-90] (copier2);
\draw (copier3) to[out=45,in=-90] (Y);
\end{tikzpicture}}}
\\
&\overset{(\mathrm{ii})}{=}\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[copier] (copier) at (0.6,-0.3) {};
\coordinate (X) at (-1.3,1.4) {};
\coordinate (Y) at (1.2,1.4) {};
\node[state] (tau) at (0.6,-0.5) {$\nu$};
\node[discarder] (d) at (0.4,1.1) {};
\node[state,hflip] (L2) at (0,0) {\;\,$\ell$\;\,};
\node[state] (sigma2) at (-0.6,-0.5) {$\sigma$};
\node[copier] (copier3) at (0.9,0.6) {};
\node[copier] (copier4) at (-0.6,-0.3) {};
\draw (tau) to (copier);
\draw (sigma2) to (copier4);
\draw (copier4) to[out=135,in=-90] (X);
\draw (copier4) to[out=15,in=-90] ([xshiftu=-.3]L2);
\draw (copier) to[out=165,in=-90] ([xshiftu=.3]L2);
\draw (copier) to[out=30,in=-90] (copier3);
\draw (copier3) to[out=165,in=-90] (d);
\draw (copier3) to[out=45,in=-90] (Y);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (sigma) at (0.15,0.3) {$\sigma$};
\node[copier] (copier) at (0.15,0.6) {};
\node[state,hflip] (L) at (0.8,2) {\;\,$\ell$\;\,};
\node [state] (tau) at (1.4,1.35) {$\nu$};
\node[copier] (copier2) at (1.4,1.65) {};
\coordinate (X) at (-0.2,2.6);
\coordinate (Y) at (1.7,2.6);
\draw (sigma) to (copier);
\draw (copier) to[out=120,in=-90] (X);
\draw (copier) to[out=60,in=-90] ([xshiftu=-.3]L);
\draw (tau) to (copier2);
\draw (copier2) to[out=150,in=-90] ([xshiftu=.3]L);
\draw (copier2) to[out=45,in=-90] (Y);
\end{tikzpicture}}}
\;\;=\;\;
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state] (sigma) at (0,0) {$\sigma$};
\node[copier] (copier) at (0,0.4) {};
\node[arrow box] (tauL) at (0.6,1.2) {$c$};
\coordinate (X) at (-0.6,1.9);
\coordinate (Y) at (0.6,1.9);
\draw (sigma) to (copier);
\draw (copier) to[out=150,in=-90] (X);
\draw (copier) to[out=20,in=-90] (tauL);
\draw (tauL) to (Y);
\end{tikzpicture}}}
\end{align*}
For the equality $\overset{(\mathrm{i})}{=}$
we use associativity and commutativity
of copiers $\copier$.
The equality $\overset{(\mathrm{ii})}{=}$
follows by:
\[
\begin{ctikzpicture}[font=\small]
\node[state] (sigma) at (-0.6,1.7) {$\sigma$};
\node[state,hflip] (q) at (0.85,1.95) {$q$};
\coordinate (Y) at (0.4,0.9);
\node[state,hflip] (L) at (-0.3,1.95) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (0.4,1.2) {};
\draw (sigma) to ([xshiftu=-.3]L);
\draw (copier2) to[out=150,in=-90] ([xshiftu=.3]L);
\draw (copier2) to[out=30,in=-90] (q);
\draw (copier2) to (Y);
\end{ctikzpicture}
\;\;\equpto\;\;
\begin{ctikzpicture}[font=\small]
\node[discarder] (d) at (0,0) {};
\draw (d) -- (0,-0.5);
\end{ctikzpicture}
\qquad\text{w.r.t.}\qquad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (L) at (-1.1,0.5) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (-0.4,0.2) {};
\node[state] (tau) at (-0.4,0) {$\nu$};
\node[state] (sigma) at (-1.4,0) {$\sigma$};
\coordinate (Y) at (-0.1,1.2);
\draw (sigma) to ([xshiftu=-.3]L);
\draw (tau) to (copier2);
\draw (copier2) to[out=165,in=-90] ([xshiftu=.3]L);
\draw (copier2) to[out=45,in=-90] (Y);
\end{tikzpicture}}}
\]
via equality strengthening.
\end{myproof}
\begin{example}
We instantiate the Theorem~\ref{thm:likelihood} in $\sfKrn$. Let
$c\colon X\krnto Y$ be a probability kernel represented by a
likelihood relation $\ell\colon X\times Y\krnto 1$ with respect to
$\nu\colon 1\krnto Y$. The relation $\ell$ is identified with a
measurable function $\ell\colon X\times Y\to[0,\infty]$ and $\nu$ with
a measure $\nu\colon\Sigma_Y\to[0,\infty]$. The
equation~\eqref{eq:likelihood} amounts to
\[
c(x,B)=
\int_B \ell(x,y)\,\nu(\dd y)
\enspace.
\]
In particular, each $\ell(x,-)$
is a probability density function, satisfying
$\int_Y \ell(x,y)\,\nu(\dd y)=1$.
Typically, we use the Lebesgue measure as $\nu$,
with $Y$ a subspace of $\RR$.
Let $\sigma\colon 1\krnto X$ be a probability measure.
Then $c_*(\sigma)\colon 1\krnto Y$ is given as:
\[
c_*(\sigma)(B)
=\int_X c(x, B)\,\sigma(\dd x)
=\int_X \int_B \ell(x,y)\,\nu(\dd y)\,\sigma(\dd x)
\]
The effect
\[
p\colon Y\krnto 1\quad=\quad
\begin{ctikzpicture}
\node[state,hflip] (L) at (0,0) {\;\,$\ell$\;\,};
\node[state] (tau) at (-0.3,-0.3) {$\sigma$};
\coordinate (X) at (0.3,-1);
\draw (X) to ([xshiftu=.3]L);
\draw (tau) to ([xshiftu=-.3]L);
\end{ctikzpicture}
\qquad
\text{is given as:}
\qquad
p(y)= \int_X \ell(x,y)\,\sigma(\dd x)
\enspace.
\]
To define an inverse of $p$,
we claim that $0<p<\infty$, $c_*(\sigma)$-almost everywhere.
We prove that $p^{-1}(\set{0,\infty})=p^{-1}(0)\cup p^{-1}(\infty)$
is $c_*(\sigma)$-negligible, as:
\begin{align*}
c_*(\sigma)\paren[\big]{p^{-1}(0)}
&=\int_X \int_{p^{-1}(0)} \ell(x,y)\,\nu(\dd y)\,\sigma(\dd x)
\\
&=\int_{p^{-1}(0)} p(x)\,\nu(\dd y)
\\
&=\int_{p^{-1}(0)} 0\,\nu(\dd y) =0
\end{align*}
and, similarly we have
\[
\int_{p^{-1}(\infty)} \infty \,\nu(\dd y)
= \int_{p^{-1}(\infty)} p(x) \,\nu(\dd y)
= c_*(\sigma)\paren[\big]{p^{-1}(\infty)} \le 1
\]
but this is possible only when
$\nu(p^{-1}(\infty))=0$,
hence $c_*(\sigma)\paren[\big]{p^{-1}(\infty)}=\int_{p^{-1}(\infty)} p(x) \,\nu(\dd y)=0$.
Now define an effect $q\colon Y\krnto 1$ by
\[
q(y)=
\begin{dcases*}
p(y)^{-1} & if $0<p(y)<\infty$ \\
0 & otherwise.
\end{dcases*}
\]
Then $p$ is $c_*(\sigma)$-almost inverted by $q$.
By Theorem~\ref{thm:likelihood}, the Bayesian inversion
for $\sigma$ along $c$ is given by
\[
d\colon Y\to X\;\;\coloneqq\quad
\vcenter{\hbox{\begin{tikzpicture}[font=\small]
\node[state,hflip] (L) at (0,0) {\;\,$\ell$\;\,};
\node[copier] (copier2) at (-0.7,-0.3) {};
\node[state] (tau) at (-0.7,-0.5) {$\sigma$};
\coordinate (Y) at (-1,0.6);
\coordinate (X) at (0.75,-1.2);
\node[copier] (copierY) at (0.75,-0.6) {};
\node[state,hflip] (q) at (1.2,0) {$q$};
\draw (X) to (copierY);
\draw (copierY) to[out=150,in=-90] ([xshiftu=.3]L);
\draw (copierY) to[out=30,in=-90] (q);
\draw (tau) to (copier2);
\draw (copier2) to[out=15,in=-90] ([xshiftu=-.3]L);
\draw (copier2) to[out=150,in=-90] (Y);
\end{tikzpicture}}}
\quad,
\]
namely,
\begin{equation}
\label{eq:inversion-by-likelihood}
\begin{aligned}
d(y,A)
&=q(y) \int_A \ell(x,y) \,\sigma(\dd x)
\\
&=
\frac{\int_A \ell(x,y) \,\sigma(\dd x)}{\int_X \ell(x,y) \,\sigma(\dd x)}
\qquad\text{whenever}\quad
0<\int_X \ell(x,y) \,\sigma(\dd x)<\infty
\end{aligned}
\end{equation}
This may be seen as a variant of the Bayes formula.
The calculation in Example~\ref{ex:inversion} is reproduced when
$\sigma$ is also given via a density function.
\end{example}
In the end we reconsider the naive Bayesian classification example
from Section~\ref{sec:classifier}. There we only considered the
discrete version. The original source~\cite{WittenFH11} also contains
a `hybrid' version, combining discrete and continuous probability.
In that hybrid form the Temperature and Humidity columns in
Figure~\ref{fig:discreteplay} are different, and are given by
numerical values. What these values are does not matter too much here,
since they are only used to calculate \emph{mean} ($\mu$) and
\emph{standard deviation} ($\sigma$) values. This is done separately
for the cases where Play is \emph{yes} or \emph{no}. It results in
the following table.
\begin{center}
{\setlength\tabcolsep{2em}\renewcommand{\arraystretch}{1.0}
\begin{tabular}{c|c|c}
& \textbf{Temperature} & \textbf{Humidity}
\\
\hline\hline
\textbf{Play} = yes
& $\mu = 73, \, \sigma = 6.2$
& $\mu = 79.1, \, \sigma = 10.2$
\\
\textbf{Play} = no
& $\mu = 74.6, \, \sigma = 7.9$
& $\mu = 86.2, \, \sigma = 9.7$
\\
\end{tabular}}
\end{center}
\noindent These $\mu,\sigma$ values are used to define two functions
$c_{T} \colon P \rightarrow \Giry(\mathbb{R})$ and $c_{H} \colon P
\rightarrow \Giry(\mathbb{R})$, with normal distributions
$\mathcal{N}$ as pdf. To be precise, these channels are defined as
follows, where $A\subseteq\mathbb{R}$ is a measurable subset.
\[ \begin{array}{rclcrcl}
c_{T}(y)(A)
& = &
\displaystyle\int_{A} \mathcal{N}(73, 6.2)(x) \intd x
& \qquad\qquad &
c_{H}(y)(A)
& = &
\displaystyle\int_{A} \mathcal{N}(79.1, 10.2)(x) \intd x
\\[+.8em]
c_{T}(n)(A)
& = &
\displaystyle\int_{A} \mathcal{N}(74.6, 7.9)(x) \intd x
& &
c_{H}(y)(A)
& = &
\displaystyle\int_{A} \mathcal{N}(86.2, 9.7)(x) \intd x.
\end{array} \]
\noindent These functions $c_T$ and $c_H$ form channels for the
Giry monad $\Giry$.
The two columns Outlook and Windy in Figure~\ref{fig:discreteplay}
remain the same. The corresponding maps $d_{O} \colon P \rightarrow
\Dst(O)$ and $d_{W} \colon P \rightarrow \Dst(W)$ for the discrete
probability monad $\Dst$ --- in Diagram~\eqref{diag:discreteplay} ---
are now written as maps $c_{O} \colon P \rightarrow \Giry(O)$ and
$c_{W} \colon P \rightarrow \Giry(W)$ for the monad $\Giry$, using the
obvious inclusion $\Dst \hookrightarrow \Giry$.
We now have four channels $c_{O} \colon P \rightarrow O$, $c_{T}
\colon P \rightarrow \mathbb{R}$, $c_{H} \colon P \rightarrow
\mathbb{R}$ and $c_{W} \colon P \rightarrow W$. We combine them, as
before, into a single channel $c\colon P \rightarrow
T\times\mathbb{R}\times\mathbb{R}\times W$. In combination with the
Play marginal distribution $\pi$ from Section~\ref{sec:classifier}, we
can compute $c$'s Bayesian inversion $f\colon
T\times\mathbb{R}\times\mathbb{R}\times W \rightarrow \Giry(P)$
via the formula \eqref{eq:inversion-by-likelihood}. We
apply it to the input data used in~\cite{WittenFH11}, and get the
following Play distribution.
\[ \begin{array}{rcl}
f(s,66,90,t)
& = &
0.207\ket{y} + 0.793\ket{n}.
\end{array} \]
\noindent The latter inversion computation produces the probability of
$0.207$ for playing when the outlook is \emph{Sunny}, the temperature
is \emph{66} (Fahrenheit), the humidity is \emph{90\%} and the
windiness is \emph{true}. The value computed in~\cite{WittenFH11} is
$20.8\%$. The minor difference of $0.001$ with our outcome can be
attributed to (intermediate) rounding errors.
Our computation is done via \EfProb, using the
formula~\eqref{eq:inversion-by-likelihood}.
\xhead*{Acknowledgements}
The research
leading to these results has received funding from the European
Research Council under the European Union's Seventh Framework
Programme (FP7/2007-2013) / ERC grant agreement nr.~320571.
The first author (KC) is also supported by
ERATO HASUO Metamathematics for Systems Design Project
(No.~JPMJER1603), JST\@.
The main part of this work was done when the first author
was a PhD student at Radboud University, Nijmegen.
\begin{thebibliography}{}
\bibitem[Abramsky and Coecke, 2009]{AbramskyC2009}
Abramsky, S. and Coecke, B. (2009).
\newblock Categorical quantum mechanics.
\newblock In {\em Handbook of Quantum Logic and Quantum Structures: Quantum
Logic}, pages 261--323. Elsevier.
\bibitem[Ackerman et~al., 2011]{AckermanFR2011}
Ackerman, N.~L., Freer, C.~E., and Roy, D.~M. (2011).
\newblock Noncomputable conditional distributions.
\newblock In {\em Logic in Computer Science (LICS 2011)}, pages 107--116. IEEE.
\bibitem[Barber, 2012]{Barber12}
Barber, D. (2012).
\newblock {\em Bayesian Reasoning and Machine Learning}.
\newblock Cambridge Univ. Press.
\bibitem[Bernardo and Smith, 2000]{BernardoS00}
Bernardo, J. and Smith, A. (2000).
\newblock {\em Bayesian Theory}.
\newblock John Wiley \& Sons.
\bibitem[Borgstr{\"o}m et~al., 2013]{BorgstromGGMG13}
Borgstr{\"o}m, J., Gordon, A., Greenberg, M., Margetson, J., and Gael, J.~V.
(2013).
\newblock Measure transformer semantics for {Bayesian} machine learning.
\newblock {\em Logical Methods in Comp. Sci.}, 9(3):1--39.
\bibitem[Chang and Pollard, 1997]{ChangP1997}
Chang, J.~T. and Pollard, D. (1997).
\newblock Conditioning as disintegration.
\newblock {\em Statistica Neerlandica}, 51(3):287--317.
\bibitem[Cho and Jacobs, 2017]{ChoJ17}
Cho, K. and Jacobs, B. (2017).
\newblock The {EfProb} library for probabilistic calculations.
\newblock In {\em Conference on Algebra and Coalgebra in Computer Science
(CALCO 2017)}, volume~72 of {\em LIPIcs}. Schloss Dagstuhl.
\bibitem[Cho et~al., 2015]{ChoJWW15b}
Cho, K., Jacobs, B., Westerbaan, A., and Westerbaan, B. (2015).
\newblock An introduction to effectus theory.
\newblock Preprint. arXiv:1512.05813v1 [cs.LO].
\bibitem[Clerc et~al., 2017]{ClercDDG2017}
Clerc, F., Danos, V., Dahlqvist, F., and Garnier, I. (2017).
\newblock Pointless learning.
\newblock In {\em Foundations of Software Science and Computation Structures
(FoSSaCS 2017)}, volume 10203 of {\em Lect. Notes Comp. Sci.}, pages
355--369. Springer.
\bibitem[Coecke, 2016]{Coecke2016}
Coecke, B. (2016).
\newblock Terminality implies no-signalling ...and much more than that.
\newblock {\em New Generation Computing}, 34(1):69--85.
\bibitem[Coecke and Kissinger, 2017]{CoeckeK2017}
Coecke, B. and Kissinger, A. (2017).
\newblock {\em Picturing Quantum Processes: A First Course in Quantum Theory
and Diagrammatic Reasoning}.
\newblock Cambridge University Press.
\bibitem[Coumans and Jacobs, 2013]{CoumansJ13}
Coumans, D. and Jacobs, B. (2013).
\newblock Scalars, monads and categories.
\newblock In Heunen, C., Sadrzadeh, M., and Grefenstette, E., editors, {\em
Quantum Physics and Linguistics. A Compositional, Diagrammatic Discourse},
pages 184--216. Oxford Univ. Press.
\bibitem[Culbertson and Sturtz, 2014]{CulbertsonS2014}
Culbertson, J. and Sturtz, K. (2014).
\newblock A categorical foundation for {Bayesian} probability.
\newblock {\em Applied Categorical Structures}, 22(4):647--662.
\bibitem[D'Ariano et~al., 2017]{DArianoCP2017}
D'Ariano, G.~M., Chiribella, G., and Perinotti, P. (2017).
\newblock {\em Quantum Theory from First Principles: An Informational
Approach}.
\newblock Cambridge University Press.
\bibitem[Dawid, 2001]{Dawid2001}
Dawid, A. (2001).
\newblock Separoids: A mathematical framework for conditional independence and
irrelevance.
\newblock {\em Annals of Mathematics and Artificial Intelligence},
32(1):335--372.
\bibitem[Doberkat, 2007]{Doberkat2007}
Doberkat, E.-E. (2007).
\newblock {\em Stochastic Relations: Foundations for Markov Transition
Systems}.
\newblock Chapman \& Hall/CRC.
\bibitem[Faden, 1985]{Faden1985}
Faden, A.~M. (1985).
\newblock The existence of regular conditional probabilities: Necessary and
sufficient conditions.
\newblock {\em The Annals of Probability}, 13(1):288--298.
\bibitem[Fong, 2012]{Fong12}
Fong, B. (2012).
\newblock Causal theories: A categorical perspective on {Bayesian} networks.
\newblock Master's thesis, Univ.\ of Oxford.
\newblock arXiv:1301.6201 [math.PR].
\bibitem[Fremlin, 2000]{FremlinAll}
Fremlin, D.~H. (2000).
\newblock {\em Measure Theory (5 volumes)}.
\newblock Torres Fremlin.
\bibitem[Geiger et~al., 1990]{GeigerVP1990}
Geiger, D., Verma, T., and Pearl, J. (1990).
\newblock Identifying independence in {Bayesian} networks.
\newblock {\em Networks}, 20:507--534.
\bibitem[Giry, 1982]{Giry1982}
Giry, M. (1982).
\newblock A categorical approach to probability theory.
\newblock In {\em Categorical Aspects of Topology and Analysis}, volume 915 of
{\em Lecture Notes in Mathematics}, pages 68--85. Springer.
\bibitem[Gordon et~al., 2014]{GordonHNRG14}
Gordon, A., Henzinger, T., Nori, A., and Rajamani, S. (2014).
\newblock Probabilistic programming.
\newblock In {\em Future of Software Engineering}, pages 167--181. ACM.
\bibitem[Jacobs, 2015]{Jacobs15d}
Jacobs, B. (2015).
\newblock New directions in categorical logic, for classical, probabilistic and
quantum logic.
\newblock {\em Logical Methods in Comp. Sci.}, 11(3):1--76.
\bibitem[Jacobs, 2018]{Jacobs17}
Jacobs, B. (2018).
\newblock From probability monads to commutative effectuses.
\newblock {\em Journ. of Logical and Algebraic Methods in Programming},
94:200--237.
\bibitem[Jacobs et~al., 2015]{JacobsWW15a}
Jacobs, B., Westerbaan, B., and Westerbaan, A. (2015).
\newblock States of convex sets.
\newblock In {\em Foundations of Software Science and Computation Structures
(FoSSaCS 2015)}, volume 9034 of {\em Lect. Notes Comp. Sci.}, pages 87--101.
Springer.
\bibitem[Jacobs and Zanasi, 2016]{JacobsZ16}
Jacobs, B. and Zanasi, F. (2016).
\newblock A predicate/state transformer semantics for {Bayesian} learning.
\newblock In {\em Mathematical Foundations of Programming Semantics (MFPS
XXXII)}, volume 325 of {\em Elect. Notes in Theor. Comp. Sci.}, pages
185--200. Elsevier.
\bibitem[Jacobs and Zanasi, 2017]{JacobsZ17}
Jacobs, B. and Zanasi, F. (2017).
\newblock A formal semantics of influence in {Bayesian} reasoning.
\newblock In {\em Mathematical Foundations of Computer Science (MFCS 2017)},
volume~83 of {\em LIPIcs}. Schloss Dagstuhl.
\bibitem[Jacobs and Zanasi, 2018]{JacobsZ18}
Jacobs, B. and Zanasi, F. (2018).
\newblock The logical essentials of {Bayesian} reasoning.
\newblock Preprint. arXiv:1804.01193v2 [cs.AI].
\bibitem[Joyal and Street, 1991]{JoyalS1991}
Joyal, A. and Street, R. (1991).
\newblock The geometry of tensor calculus, {I}.
\newblock {\em Advances in Mathematics}, 88(1):55--112.
\bibitem[Kallenberg, 2017]{Kallenberg2017}
Kallenberg, O. (2017).
\newblock {\em Random Measures, Theory and Applications}.
\newblock Springer.
\bibitem[Katoen et~al., 2015]{KatoenGJKO2015}
Katoen, J.-P., Gretz, F., Jansen, N., Lucien~Kaminski, B., and Olmedo, F.
(2015).
\newblock Understanding probabilistic programs.
\newblock In {\em Correct System Design}, volume 9360 of {\em Lect. Notes Comp.
Sci.}, pages 15--32. Springer.
\bibitem[Mac~Lane, 1998]{MacLane1998}
Mac~Lane, S. (1998).
\newblock {\em Categories for the Working Mathematician}.
\newblock Springer, second edition.
\bibitem[Pachl, 1978]{Pachl1978}
Pachl, J.~K. (1978).
\newblock Disintegration and compact measures.
\newblock {\em Mathematica Scandinavica}, 43:157--168.
\bibitem[Panangaden, 2009]{Panangaden09}
Panangaden, P. (2009).
\newblock {\em Labelled {Markov} Processes}.
\newblock Imperial College Press.
\bibitem[Pawitan, 2001]{Pawitan01}
Pawitan, Y. (2001).
\newblock {\em In All Likelihood. Statistical Modelling and Inference Using
Likelihood}.
\newblock Clarendon Press.
\bibitem[Pearl, 1988]{Pearl88}
Pearl, J. (1988).
\newblock {\em Probabilistic Reasoning in Intelligent Systems}.
\newblock Morgan Kaufmann.
\bibitem[Pollard, 2002]{Pollard2002}
Pollard, D. (2002).
\newblock {\em A User's Guide to Measure Theoretic Probability}.
\newblock Cambridge University Press.
\bibitem[Selinger, 2010]{Selinger2010}
Selinger, P. (2010).
\newblock A survey of graphical languages for monoidal categories.
\newblock In {\em New Structures for Physics}, volume 813 of {\em Lecture Notes
in Physics}, pages 289--355. Springer.
\bibitem[Shan and Ramsey, 2017]{ShanR17}
Shan, C.-c. and Ramsey, N. (2017).
\newblock Exact {Bayesian} inference by symbolic disintegration.
\newblock In {\em Principles of Programming Languages (POPL 2017)}, pages
130--144. ACM.
\bibitem[Simpson, 2018]{Simpson2017}
Simpson, A. (2018).
\newblock Category-theoretic structure for independence and conditional
independence.
\newblock In {\em Mathematical Foundations of Programming Semantics (MFPS
XXXIII)}, volume 336 of {\em Elect. Notes in Theor. Comp. Sci.} Elsevier.
\bibitem[Staton, 2017]{Staton2017}
Staton, S. (2017).
\newblock Commutative semantics for probabilistic programming.
\newblock In {\em European Symposium on Programming (ESOP 2017)}, volume 10201
of {\em Lect. Notes Comp. Sci.}, pages 855--879. Springer.
\bibitem[Staton et~al., 2016]{StatonYHKW16}
Staton, S., Yang, H., Heunen, C., Kammar, O., and Wood, F. (2016).
\newblock Semantics for probabilistic programming: higher-order functions,
continuous distributions, and soft constraints.
\newblock In {\em Logic in Computer Science (LICS 2016)}, pages 525--534. ACM.
\bibitem[Stoyanov, 2014]{Stoyanov2014}
Stoyanov, J.~M. (2014).
\newblock {\em Counterexamples in Probability}.
\newblock Dover, third edition.
\bibitem[Verma and Pearl, 1988]{VermaP1988}
Verma, T. and Pearl, J. (1988).
\newblock Causal networks: Semantics and expressiveness.
\newblock In {\em Fourth Conference on Uncertainty in Artificial Intelligence
(UAI 1988)}, pages 352--359.
\bibitem[Witten et~al., 2011]{WittenFH11}
Witten, I., Frank, E., and Hall, M. (2011).
\newblock {\em Data Mining -- Practical Machine Learning Tools and Techniques}.
\newblock Elsevier.
\end{thebibliography}
\end{document}
|