aboutsummaryrefslogtreecommitdiffstats
path: root/libnormalform.h
blob: ed3b2561ac5ac61b7d80d6b2ad36c530bdf98b78 (plain) (blame)
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
/* See LICENSE file for copyright and license details. */
#ifndef LIBNORMALFORM_H
#define LIBNORMALFORM_H

#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>


#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Winline"
#endif


/* For internal use { */

#if defined(__GNUC__)
# define LIBNORMALFORM_USE_RESULT__ __attribute__((__warn_unused_result__))
# define LIBNORMALFORM_FREE_WITH__(DESTRUCTOR) __attribute__((__malloc__(DESTRUCTOR)))
# define LIBNORMALFORM_USE_FREE__ __attribute__((__malloc__))
# define LIBNORMALFORM_NONNULL_INPUT__ __attribute__((__nonnull__))
# define LIBNORMALFORM_ONE_NONNULL_INPUT__(INDEX) __attribute__((__nonnull__(INDEX)))
# if defined(LIBNORMALFORM_ALLOW_BAD_WARNINGS)
#  define LIBNORMALFORM_NULL_LAST__ __attribute__((__sentinel__))
# else
#  define LIBNORMALFORM_NULL_LAST__
# endif
/*
 * Unfortunately __attribute__((__sentinel__)) requires (in contrary to the
 * documentation) the `NULL` to be inside `...`, and not at the argument before
 * the `...`, so a "-Wformat=" warning will be generated if and empty list is
 * used when constructing a sentence. Therefore, by default this attribute is
 * not used, as the user may have configured the compiler to fail if the warning
 * is generated.
 */
#else
# define LIBNORMALFORM_USE_RESULT__
# define LIBNORMALFORM_FREE_WITH__(DESTRUCTOR)
# define LIBNORMALFORM_USE_FREE__
# define LIBNORMALFORM_NONNULL_INPUT__
# define LIBNORMALFORM_ONE_NONNULL_INPUT__(INDEX)
# define LIBNORMALFORM_NULL_LAST__
#endif


#define LIBNORMALFORM_CHECKED__(CONNECTIVE)\
	size_t i__ = 0;\
	while (xs[i__])\
		i__ += 1;\
	if (i__ < n) {\
		while (n--)\
			libnormalform_free(xs[n]);\
		return NULL;\
	}\
	return libnormalform_##CONNECTIVE(xs);

#define LIBNORMALFORM_VALIST__(CONNECTIVE)\
	size_t n__ = 0, i__ = 0;\
	va_list args2__;\
	va_copy(args2__, args);\
	if (a) {\
		do {\
			n__ += 1;\
		} while (va_arg(args2__, LIBNORMALFORM_SENTENCE *));\
	}\
	va_end(args2__);\
	{\
		LIBNORMALFORM_SENTENCE *xs[n__ + 1U];\
		if (n__) {\
			xs[i__++] = a;\
			while (--n__)\
				xs[i__++] = va_arg(args, LIBNORMALFORM_SENTENCE *);\
		}\
		xs[i__] = NULL;\
		return libnormalform_##CONNECTIVE(xs);\
	}

#define LIBNORMALFORM_ELLIPSIS__(CONNECTIVE)\
	LIBNORMALFORM_SENTENCE *ret__;\
	va_list args__;\
	va_start(args__, a);\
	ret__ = libnormalform_v##CONNECTIVE(a, args__);\
	va_end(args__);\
	return ret__;

#define LIBNORMALFORM_VALIST_CHECKED__(CONNECTIVE)\
	size_t n__ = 0, i__ = 0;\
	va_list args2__;\
	va_copy(args2__, args);\
	if (a) {\
		do {\
			n__ += 1;\
		} while (va_arg(args2__, LIBNORMALFORM_SENTENCE *));\
	}\
	va_end(args2__);\
	if (n__ < n) {\
		if (n) {\
			libnormalform_free(a);\
			while (--n)\
				libnormalform_free(va_arg(args2__, LIBNORMALFORM_SENTENCE *));\
		}\
		return NULL;\
	}\
	{\
		LIBNORMALFORM_SENTENCE *xs__[n__ + 1U];\
		if (n__) {\
			xs__[i__++] = a;\
			while (--n__)\
				xs__[i__++] = va_arg(args, LIBNORMALFORM_SENTENCE *);\
		}\
		xs__[i__] = NULL;\
		return libnormalform_##CONNECTIVE(xs__);\
	}

#define LIBNORMALFORM_ELLIPSIS_CHECKED__(CONNECTIVE)\
	LIBNORMALFORM_SENTENCE *ret__;\
	va_list args__;\
	va_start(args__, a);\
	ret__ = libnormalform_v##CONNECTIVE##_checked(n, a, args__);\
	va_end(args__);\
	return ret__;

#define LIBNORMALFORM_TWO__(CONNECTIVE)\
	LIBNORMALFORM_SENTENCE *xs__[3] = {l, r, NULL};\
	if (!l || !r) {\
		libnormalform_free(l);\
		libnormalform_free(r);\
		return NULL;\
	}\
	return libnormalform_##CONNECTIVE(xs__);

#define LIBNORMALFORM_MACRO__(CONNECTIVE, ...)\
	(libnormalform_##CONNECTIVE##_checked(\
		sizeof((LIBNORMALFORM_SENTENCE *[]){__VA_OPT__(__VA_ARGS__,) NULL}) / sizeof(LIBNORMALFORM_SENTENCE *) - 1U,\
		(LIBNORMALFORM_SENTENCE *[]){__VA_OPT__(__VA_ARGS__,) NULL}))

/* } */


struct libnormalform_term;





#define LIBNORMALFORM_AVOID_FOR_ALL                 (UINT64_C(1) <<  0) /**< Prefer ¬∃x.¬φ over ∀x.φ */
#define LIBNORMALFORM_AVOID_NEGATED_FOR_ALL         (UINT64_C(1) <<  1) /**< Prefer  ∃x.¬φ over ¬∀x.φ */
#define LIBNORMALFORM_AVOID_FOR_ANY                 (UINT64_C(1) <<  2) /**< Prefer ¬∀x.¬φ over ∃x.φ */
#define LIBNORMALFORM_AVOID_NEGATED_FOR_ANY         (UINT64_C(1) <<  3) /**< Prefer  ∀x.¬φ over ¬∃x.φ */
#define LIBNORMALFORM_RELAX_FOR_ONE                 (UINT64_C(1) <<  4) /**< Relax any positive ∃!x.φ into ∃x.φ */
#define LIBNORMALFORM_REDUCE_XOR                    (UINT64_C(1) <<  5) /**< Rewrite XOR to negation normal form */
#define LIBNORMALFORM_JOIN_SIDES_IN_FOR_ALL         (UINT64_C(1) <<  6) /**< Express   φ(x)∀x:θ(x)   on the form  ∀x.(θ(x) → φ(x)) */
#define LIBNORMALFORM_JOIN_SIDES_IN_NEGATED_FOR_ALL (UINT64_C(1) <<  7) /**< Express ¬(φ(x)∀x:θ(x))  on the form ¬∀x.(θ(x) → φ(x)) */
#define LIBNORMALFORM_JOIN_SIDES_IN_FOR_ANY         (UINT64_C(1) <<  8) /**< Express   φ(x)∃x:θ(x)   on the form  ∃x.(θ(x) ∧ φ(x)) */
#define LIBNORMALFORM_JOIN_SIDES_IN_NEGATED_FOR_ANY (UINT64_C(1) <<  9) /**< Express ¬(φ(x)∃x:θ(x))  on the form ¬∃x.(θ(x) ∧ φ(x)) */
#define LIBNORMALFORM_JOIN_SIDES_IN_FOR_ONE         (UINT64_C(1) << 10) /**< Express   φ(x)∃!x:θ(x)  on the form  ∃!x.(θ(x) ∧ φ(x)) */
#define LIBNORMALFORM_JOIN_SIDES_IN_NEGATED_FOR_ONE (UINT64_C(1) << 11) /**< Express ¬(φ(x)∃!x:θ(x)) on the form ¬∃!x.(θ(x) ∧ φ(x)) */
#define LIBNORMALFORM_ELIMINATE_FOR_ALL             (UINT64_C(1) << 12) /**< Relax any non-translatable  ∀x.φ to ⊤ */
#define LIBNORMALFORM_ELIMINATE_NEGATED_FOR_ALL     (UINT64_C(1) << 13) /**< Relax any non-translatable ¬∀x.φ to ⊤ */
#define LIBNORMALFORM_ELIMINATE_FOR_ANY             (UINT64_C(1) << 14) /**< Relax any non-translatable  ∃x.φ to ⊤ */
#define LIBNORMALFORM_ELIMINATE_NEGATED_FOR_ANY     (UINT64_C(1) << 15) /**< Relax any non-translatable ¬∃x.φ to ⊤ */
#define LIBNORMALFORM_ELIMINATE_FOR_ONE             (UINT64_C(1) << 16) /**< Relax any non-translatable ∃!x.φ to ⊤ */
#define LIBNORMALFORM_ELIMINATE_NEGATED_FOR_ONE     (UINT64_C(1) << 17) /**< Relax any ¬∃!x.φ to ⊤ */
#define LIBNORMALFORM_ELIMINATE_VARIABLE            (UINT64_C(1) << 18) /**< Relax any positive variable literal to ⊤ */
#define LIBNORMALFORM_ELIMINATE_NEGATED_VARIABLE    (UINT64_C(1) << 19) /**< Relax any negative variable literal to ⊤ */
#define LIBNORMALFORM_ELIMINATE_FUNCTION            (UINT64_C(1) << 20) /**< Relax any positive function literal to ⊤ */
#define LIBNORMALFORM_ELIMINATE_NEGATED_FUNCTION    (UINT64_C(1) << 21) /**< Relax any negative function literal to ⊤ */
#define LIBNORMALFORM_ELIMINATE_XOR                 (UINT64_C(1) << 22) /**< Relax any non-reduce XOR to ⊤ */
#define LIBNORMALFORM_ALL_EXPRESS_FLAGS__          ((UINT64_C(1) << 23) - 1U) /* For internal use */


/**
 * Opaque data type use to express and sentences
 *
 * This object incluses caches and preallocated memory
 * makes object unsafe to be used from two different
 * threads at the same time
 *
 * @seealso  libnormalform_clone
 */
typedef struct libnormalform_sentence LIBNORMALFORM_SENTENCE;


/**
 * Specification for how application provided strings
 * shall be interpreted
 */
struct libnormalform_representation_spec {
	/**
	 * Application-specific data that will be passed into
	 * `.get_variable`, `.get_function`, `.get_map`, and
	 * `.get_transformer` (making it reenterant so it can be
	 * called by multiple threads, or to configure the function)
	 * 
	 * May be `NULL`
	 */
	void *user_data;

	/**
	 * Deserialise a variable from a unterminated string
	 * 
	 * The function shall be able to return the reference
	 * to any `struct libnormalform_variable` given its
	 * `.identifier` sans NUL-termination
	 * 
	 * The function shall be pure in the sence that if
	 * it is called twice (or more) with the identifer
	 * at the beginning of `s` it shall return the same
	 * pointer, not two different copies (`user_data` be
	 * use used to store the variables if they are
	 * constructed dynamically)
	 * 
	 * May be `NULL`
	 * 
	 * @param   s           The string beginning with the variable's
	 *                      identifier
	 * @param   end_out     Output parameter for the position in
	 *                      `s` after the last byte in the identifer
	 * @param   user_data   `.user_data`
	 * @return              A pointer to the referenced variable, `NULL`
	 *                      on failure (`errno` may be set)
	 * 
	 * It is recommended that, on failure, `errno` is set
	 * according to the below specification, however it is
	 * up to the application to choose what to do with `errno`
	 * 
	 * @throws  EINVAL  `s` in not formatted to represent a valid variable
	 * @throws  ENOENT  `s` does not represent any known variable
	 */
	struct libnormalform_variable *(*get_variable)(char *s, char **end_out, void *user_data);

	/**
	 * Same as `.get_variable` except that it returns
	 * reference to a function (`struct libnormalform_function *`)
	 */
	struct libnormalform_function *(*get_function)(char *s, char **end_out, void *user_data);

	/**
	 * Same as `.get_variable` except that it returns
	 * reference to a domain (`struct libnormalform_map *`)
	 */
	struct libnormalform_map *(*get_map)(char *s, char **end_out, void *user_data);

	/**
	 * Same as `.get_transformer` except that it returns
	 * reference to a function (`struct libnormalform_transformer *`)
	 */
	struct libnormalform_transformer *(*get_transformer)(char *s, char **end_out, void *user_data);
};


/**
 * Type if a `struct libnormalform_term`, used to
 * determine which member of `.term` to use and
 * whether it is negated
 */
enum libnormalform_term_type {
	LIBNORMALFORM_CONJUNCTION,            /**< AND clause; empty clause is used for contradiction */
	LIBNORMALFORM_DISJUNCTION,            /**< OR  clause; empty clause is used for tautology */
	LIBNORMALFORM_EXCLUSIVE_DISJUNCTION,  /**< XOR clause; never used for empty clauses */
	LIBNORMALFORM_TRANSFORMATION,         /**< Transformater function with input **/
	LIBNORMALFORM_VARIABLE,               /**< Positive variable literal **/
	LIBNORMALFORM_NEGATED_VARIABLE,       /**< Negative variable literal **/
	LIBNORMALFORM_FUNCTION,               /**< Positive boolean function literal **/
	LIBNORMALFORM_NEGATED_FUNCTION,       /**< Negative boolean function literal **/
	LIBNORMALFORM_FOR_ALL,                /**<  ∀x∈D.(P(x) → Q(x)) expression */
	LIBNORMALFORM_NEGATED_FOR_ALL,        /**< ¬∀x∈D.(P(x) → Q(x)) expression */
	LIBNORMALFORM_FOR_ANY,                /**<  ∃x∈D.(P(x) ∧ Q(x)) expression */
	LIBNORMALFORM_NEGATED_FOR_ANY,        /**< ¬∃x∈D.(P(x) ∧ Q(x)) expression */
	LIBNORMALFORM_FOR_ONE,                /**<  ∃!x∈D.(P(x) ∧ Q(x)) expression */
	LIBNORMALFORM_NEGATED_FOR_ONE         /**< ¬∃!x∈D.(P(x) ∧ Q(x)) expression */
};


/**
 * Value of an atomic sentence
 */
enum libnormalform_value {
	LIBNORMALFORM_FALSE = 0,  /**< Variable has the value False */
	LIBNORMALFORM_TRUE = 1    /**< Variable has the value True */
};


/**
 * Built in transformer functions
 */
enum libnormalform_builtin_transformer {
	LIBNORMALFORM_NOT_BUILT_IN = 0,  /**< Application provided transformer */
	LIBNORMALFORM_DOMAIN_VIEW,   /**< Selects the `.key` from a `struct libnormalform_mapping *` */
	LIBNORMALFORM_IMAGE_VIEW     /**< Selects the `.value` from a `struct libnormalform_mapping *` */
};


/**
 * Relationship (dependency) between the value of two sentences
 */
enum libnormalform_sentences_relationship {
	/**
	 * Left-hand implies right-hand (⊨ P → Q)
	 * 
	 * Example:
	 * -  P = ⋀{a, b}, Q = ⋀{a}
	 * 
	 * Truthtable:
	 *    P: 001
	 *    Q: 011
	 *    ∧: 001
	 *    ∨: 011
	 *    ⊕: 010
	 *    →: 111
	 *    ←: 101
	 * 
	 * Consequence:
	 * -  P ∧ Q = P
	 * -  P ∨ Q = Q
	 * -  P ⊕ Q = ¬P ∧ Q
	 * -  P → Q = ⊤
	 * -  P ← Q cannot be simplified
	 */
	LIBNORMALFORM_MATERIAL_IMPLICATION = -1,

	/**
	 * The terms are identical (⊨ P ↔ Q)
	 * 
	 * Example:
	 * -  P = ⋀{a, b}, Q = ⋀{a, b}
	 * 
	 * Truthtable:
	 *    P: 01
	 *    Q: 01
	 *    ∧: 01
	 *    ∨: 01
	 *    ⊕: 00
	 *    →: 11
	 *    ←: 11
	 * 
	 * Consequence:
	 * -  P ∧ Q = P = Q
	 * -  P ∨ Q = P = Q
	 * -  P ⊕ Q = ⊥
	 * -  P → Q = ⊤
	 * -  P ← Q = ⊤
	 */
	LIBNORMALFORM_IDENTICAL,

	/**
	 * Right-hand implies left-hand (⊨ P ← Q)
	 * 
	 * Example:
	 * -  P = ⋀{a}, Q = ⋀{a, b}
	 * 
	 * Truthtable:
	 *    P: 011
	 *    Q: 001
	 *    ∧: 001
	 *    ∨: 011
	 *    ⊕: 010
	 *    →: 101
	 *    ←: 111
	 * 
	 * Consequence:
	 * -  P ∧ Q = Q
	 * -  P ∨ Q = P
	 * -  P ⊕ Q = P ∧ ¬Q
	 * -  P → Q cannot be simplified
	 * -  P ← Q = ⊤
	 */
	LIBNORMALFORM_CONVERSE_IMPLICATION,

	/**
	 * The terms are the inverse of each other (⊨ P ↮ Q)
	 * 
	 * Example:
	 * -  P = a, Q = ¬a
	 * 
	 * Truthtable:
	 *    P: 01
	 *    Q: 10
	 *    ∧: 00
	 *    ∨: 11
	 *    ⊕: 11
	 *    →: 10
	 *    ←: 01
	 * 
	 * Consequence:
	 * -  P ∧ Q = ⊥
	 * -  P ∨ Q = ⊤
	 * -  P ⊕ Q = ⊤
	 * -  P → Q = Q
	 * -  P ← Q = P
	 */
	LIBNORMALFORM_MUTUALLY_INVERSE,

	/**
	 * Both terms cannot be satisfied at the same time,
	 * but are not each other's inverse (⊨ P ⊼ Q)
	 * 
	 * Example:
	 * -  P = ⋀{a, b}, Q = ⋀{¬b}
	 * 
	 * Truthtable:
	 *    P: 001
	 *    Q: 010
	 *    ∧: 000
	 *    ∨: 011
	 *    ⊕: 011
	 *    →: 110
	 *    ←: 101
	 * 
	 * Consequence:
	 * -  P ∧ Q = ⊥
	 * -  P ∨ Q cannot be simplified
	 * -  P ⊕ Q = P ∨ Q
	 * -  P → Q = ¬P
	 * -  P ← Q = ¬Q
	 */
	LIBNORMALFORM_MUTUALLY_EXCLUSIVE,

	/**
	 * The terms cannot be unsatisfied at the same time,
	 * but they are not identical (⊨ P ∨ Q)
	 * 
	 * Example:
	 * -  P = ⋁{a, b}, Q = ⋁{¬b}
	 * 
	 * Truthtable:
	 *    P: 011
	 *    Q: 101
	 *    ∧: 001
	 *    ∨: 111
	 *    ⊕: 110
	 *    →: 101
	 *    ←: 011
	 * 
	 * Consequence:
	 * -  P ∧ Q cannot be simplified
	 * -  P ∨ Q = ⊤
	 * -  P ⊕ Q = ¬P ∨ ¬Q
	 * -  P → Q = Q
	 * -  P ← Q = P
	 */
	LIBNORMALFORM_JOINTLY_UNDENIABLE,

	/**
	 * The terms are unrelated to each other
	 * 
	 * Example:
	 * -  P = a, Q = b
	 * 
	 * Truthtable:
	 *    P: 0011
	 *    Q: 0101
	 *    ∧: 0001
	 *    ∨: 0111
	 *    ⊕: 0110
	 *    →: 1101
	 *    ←: 1011
	 * 
	 * Consequence:
	 * -  P ∧ Q cannot be simplified
	 * -  P ∨ Q cannot be simplified
	 * -  P ⊕ Q cannot be simplified
	 * -  P → Q cannot be simplified
	 * -  P ← Q cannot be simplified
	 */
	LIBNORMALFORM_MUTUALLY_INDEPENDENT
};



/**
 * Relationship (commonality) between the value of two domains
 *
 * (The documentation uses the term "set", however,
 * properly they are bags (multisets), however this
 * is only important for uniqueness qualification;
 * for the mathematics, you can thing about it as
 * sets)
 */
enum libnormalform_domain_relationship {
	/**
	 * The left-hand set is a superset of the right-hand set (A ⊇ B)
	 * 
	 * Example:
	 * -  A = {a, b}, B = {a}
	 * 
	 * Euler diagram:
	 *    ┌────────────────────────────┐
	 *    │  ┌─A────────────────┐      │
	 *    │  │╱╱╱╱╱╱╱┌─B──────┐╱│      │
	 *    │  │╱╱╱╱╱╱╱│╳╳╳╳╳╳╳╳│╱│      │
	 *    │  │╱╱╱╱╱╱╱│╳╳╳╳╳╳╳╳│╱│      │
	 *    │  │╱╱╱╱╱╱╱│╳╳╳╳╳╳╳╳│╱│      │
	 *    │  │╱╱╱╱╱╱╱└────────┘╱│      │
	 *    │  │╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱│      │
	 *    │  └──────────────────┘      │
	 *    └────────────────────────────┘
	 * 
	 * Venn diagram of possibly non-empty intersections:
	 *    ┌────────────────────────────┐
	 *    │  ┌─A─────────────┐         │
	 *    │  │███████████████│         │
	 *    │  │██████┌────────┼──────┐  │
	 *    │  │██████│████████│      │  │
	 *    │  │██████│████████│      │  │
	 *    │  └──────┼────────┘      │  │
	 *    │         │               │  │
	 *    │         └─────────────B─┘  │
	 *    └────────────────────────────┘
	 * 
	 * Consequence:
	 * -  A ∩ B = B
	 * -  A ∪ B = A
	 * -  A ∆ B = A ∖ B
	 * -  ⋀A ⊨ ⋀B
	 * -  ⋁B ⊨ ⋁A
	 * -  ⋀A ∧ ⋀B = ⋀A
	 * -  ⋀A ∨ ⋀B = ⋀B
	 * -  ⋀A ⊕ ⋀B = ¬⋀A ∧ ⋀B
         * -  ⋀A → ⋀B = ⊤
	 * -  ⋀A ← ⋀B cannot be simplified
	 * -  ⋁A ∧ ⋁B = ⋁B
	 * -  ⋁A ∨ ⋁B = ⋁A
	 * -  ⋁A ⊕ ⋁B = ⋁A ∧ ¬⋁B
         * -  ⋁A → ⋁B cannot be simplified
	 * -  ⋁A ← ⋁B = ⊤
	 */
	LIBNORMALFORM_SUPERSET_OF = -1,

	/**
	 * The two terms are identical (A = B)
	 * 
	 * Example:
	 * -  A = {a, b}, B = {a, b}
	 * 
	 * Euler diagram:
	 *    ┌────────────────────────────┐
	 *    │    ┌─A,B──────────────┐    │
	 *    │    │╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳│    │
	 *    │    │╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳│    │
	 *    │    │╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳│    │
	 *    │    │╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳│    │
	 *    │    │╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳│    │
	 *    │    │╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳╳│    │
	 *    │    └──────────────────┘    │
	 *    └────────────────────────────┘
	 * 
	 * Venn diagram of possibly non-empty intersections:
	 *    ┌────────────────────────────┐
	 *    │  ┌─A─────────────┐         │
	 *    │  │               │         │
	 *    │  │      ┌────────┼──────┐  │
	 *    │  │      │████████│      │  │
	 *    │  │      │████████│      │  │
	 *    │  └──────┼────────┘      │  │
	 *    │         │               │  │
	 *    │         └─────────────B─┘  │
	 *    └────────────────────────────┘
	 * 
	 * Consequence:
	 * -  A ∩ B = A = B
	 * -  A ∪ B = A = B
	 * -  A ∆ B = ∅
	 * -  ⋀A = ⋀B
	 * -  ⋁A = ⋁B
	 * -  ⋀A ∧ ⋀B = ⋀A = ⋀B
	 * -  ⋀A ∨ ⋀B = ⋀A = ⋀B
	 * -  ⋀A ⊕ ⋀B = ⊥
         * -  ⋀A → ⋀B = ⊤
	 * -  ⋀A ← ⋀B = ⊤
	 * -  ⋁A ∧ ⋁B = ⋁A = ⋁B
	 * -  ⋁A ∨ ⋁B = ⋁A = ⋁B
	 * -  ⋁A ⊕ ⋁B = ⊥
         * -  ⋁A → ⋁B = ⊤
	 * -  ⋁A ← ⋁B = ⊤
	 */
	LIBNORMALFORM_SAME_AS,

	/**
	 * The left-hand set is a subset of the right-hand set (A ⊆ B)
	 * 
	 * Example:
	 * -  A = {a}, B = {a, b}
	 * 
	 * Euler diagram:
	 *    ┌────────────────────────────┐
	 *    │      ┌─B────────────────┐  │
	 *    │      │╲┌─A──────┐╲╲╲╲╲╲╲│  │
	 *    │      │╲│╳╳╳╳╳╳╳╳│╲╲╲╲╲╲╲│  │
	 *    │      │╲│╳╳╳╳╳╳╳╳│╲╲╲╲╲╲╲│  │
	 *    │      │╲│╳╳╳╳╳╳╳╳│╲╲╲╲╲╲╲│  │
	 *    │      │╲└────────┘╲╲╲╲╲╲╲│  │
	 *    │      │╲╲╲╲╲╲╲╲╲╲╲╲╲╲╲╲╲╲│  │
	 *    │      └──────────────────┘  │
	 *    └────────────────────────────┘
	 * 
	 * Venn diagram of possibly non-empty intersections:
	 *    ┌────────────────────────────┐
	 *    │  ┌─A─────────────┐         │
	 *    │  │               │         │
	 *    │  │      ┌────────┼──────┐  │
	 *    │  │      │████████│██████│  │
	 *    │  │      │████████│██████│  │
	 *    │  └──────┼────────┘██████│  │
	 *    │         │███████████████│  │
	 *    │         └─────────────B─┘  │
	 *    └────────────────────────────┘
	 * 
	 * Consequence:
	 * -  A ∩ B = A
	 * -  A ∪ B = B
	 * -  A ∆ B = B ∖ A
	 * -  ⋀B ⊨ ⋀A
	 * -  ⋁A ⊨ ⋁B
	 * -  ⋀A ∧ ⋀B = ⋀B
	 * -  ⋀A ∨ ⋀B = ⋀A
	 * -  ⋀A ⊕ ⋀B = ⋀A ∧ ¬⋀B
         * -  ⋀A → ⋀B cannot be simplified
	 * -  ⋀A ← ⋀B = ⊤
	 * -  ⋁A ∧ ⋁B = ⋁A
	 * -  ⋁A ∨ ⋁B = ⋁B
	 * -  ⋁A ⊕ ⋁B = ¬⋁A ∧ ⋁B
         * -  ⋁A → ⋁B = ⊤
	 * -  ⋁A ← ⋁B cannot be simplified
	 */
	LIBNORMALFORM_SUBSET_OF,

	/**
	 * The sets have no common elements (A ∩ B = ∅)
	 * 
	 * Example:
	 * -  A = {a}, B = {b}
	 * 
	 * Euler diagram:
	 *    ┌────────────────────────────┐
	 *    │  ┌─A───────┐  ┌─B───────┐  │
	 *    │  │╱╱╱╱╱╱╱╱╱│  │╲╲╲╲╲╲╲╲╲│  │
	 *    │  │╱╱╱╱╱╱╱╱╱│  │╲╲╲╲╲╲╲╲╲│  │
	 *    │  │╱╱╱╱╱╱╱╱╱│  │╲╲╲╲╲╲╲╲╲│  │
	 *    │  │╱╱╱╱╱╱╱╱╱│  │╲╲╲╲╲╲╲╲╲│  │
	 *    │  │╱╱╱╱╱╱╱╱╱│  │╲╲╲╲╲╲╲╲╲│  │
	 *    │  │╱╱╱╱╱╱╱╱╱│  │╲╲╲╲╲╲╲╲╲│  │
	 *    │  └─────────┘  └─────────┘  │
	 *    └────────────────────────────┘
	 * 
	 * Venn diagram of possibly non-empty intersections:
	 *    ┌────────────────────────────┐
	 *    │  ┌─A─────────────┐         │
	 *    │  │███████████████│         │
	 *    │  │██████┌────────┼──────┐  │
	 *    │  │██████│        │██████│  │
	 *    │  │██████│        │██████│  │
	 *    │  └──────┼────────┘██████│  │
	 *    │         │███████████████│  │
	 *    │         └─────────────B─┘  │
	 *    └────────────────────────────┘
	 * 
	 * Consequence:
	 * -  A ∩ B = ∅
	 * -  A ∪ B cannot be simplified
	 * -  A ∆ B = A ∪ B
	 * -  ⋀A ∧ ⋀B = ⋀(A ∪ B)
	 * -  ⋀A ∨ ⋀B cannot be simplified
	 * -  ⋀A ⊕ ⋀B cannot be simplified
         * -  ⋀A → ⋀B cannot be simplified
	 * -  ⋀A ← ⋀B cannot be simplified
	 * -  ⋁A ∧ ⋁B cannot be simplified
	 * -  ⋁A ∨ ⋁B = ⋁(A ∪ B)
	 * -  ⋁A ⊕ ⋁B cannot be simplified
         * -  ⋁A → ⋁B cannot be simplified
	 * -  ⋁A ← ⋁B cannot be simplified
	 */
	LIBNORMALFORM_DISJOINT_WITH,

	/**
	 * Both sets have unique elements (A ⊆ A ∪ B ⊇ B, A ∩ B ⊇ ∅)
	 * 
	 * Example:
	 * -  A = {a, b}, B = {b, c}
	 * 
	 * Euler diagram:
	 *    ┌────────────────────────────┐
	 *    │  ┌─A─────────────┐         │
	 *    │  │╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱│         │
	 *    │  │╱╱╱╱╱╱┌────────┼────B─┐  │
	 *    │  │╱╱╱╱╱╱│╳╳╳╳╳╳╳╳│╲╲╲╲╲╲│  │
	 *    │  │╱╱╱╱╱╱│╳╳╳╳╳╳╳╳│╲╲╲╲╲╲│  │
	 *    │  └──────┼────────┘╲╲╲╲╲╲│  │
	 *    │         │╲╲╲╲╲╲╲╲╲╲╲╲╲╲╲│  │
	 *    │         └───────────────┘  │
	 *    └────────────────────────────┘
	 * 
	 * Venn diagram of possibly non-empty intersections:
	 *    ┌────────────────────────────┐
	 *    │  ┌─A─────────────┐         │
	 *    │  │███████████████│         │
	 *    │  │██████┌────────┼──────┐  │
	 *    │  │██████│████████│██████│  │
	 *    │  │██████│████████│██████│  │
	 *    │  └──────┼────────┘██████│  │
	 *    │         │███████████████│  │
	 *    │         └─────────────B─┘  │
	 *    └────────────────────────────┘
	 * 
	 * Consequence:
	 * -  A ∩ B cannot be simplified
	 * -  A ∪ B cannot be simplified
	 * -  A ∆ B cannot be simplified
	 * -  ⋀A ∧ ⋀B = ⋀(A ∪ B)
	 * -  ⋀A ∨ ⋀B cannot be simplified
	 * -  ⋀A ⊕ ⋀B cannot be simplified
         * -  ⋀A → ⋀B cannot be simplified
	 * -  ⋀A ← ⋀B cannot be simplified
	 * -  ⋁A ∧ ⋁B cannot be simplified
	 * -  ⋁A ∨ ⋁B = ⋁(A ∪ B)
	 * -  ⋁A ⊕ ⋁B cannot be simplified
         * -  ⋁A → ⋁B cannot be simplified
	 * -  ⋁A ← ⋁B cannot be simplified
	 */
	LIBNORMALFORM_CONJOINT_WITH
};


/**
 * Variable that can be referenced in a sentence
 */
struct libnormalform_variable {
	/**
	 * The value of the sentence
	 *
	 * This need not be sent when the sentence is constructed,
	 * but not be set before it is evaluated; it is only used
	 * by `libnormalform_evaluate`
	 */
	enum libnormalform_value value;

	/**
	 * Application-specific data that the application
	 * could use to identify the variable
	 * 
	 * May be `NULL`
	 */
	void *user_data;

	/**
	 * Identifier for variable
	 *
	 * This need only be set when `libnormalform_to_string`
	 * is called. The value must be parsable by the application
	 * without any explicit termination
	 */
	const char *identifier;

	/**
	 * `NULL` or copy of of the object for `libnormalform_clone`
	 * 
	 * This field should normally be unset, but before calling
	 * `libnormalform_clone`, the application must set it
	 * either to `NULL` (if the clone can use the same reference)
	 * or to a clone of the variable.
	 */
	struct libnormalform_variable *copy_for_clone;
};


/**
 * Boolean-codomain function that can be referenced in a sentence
 */
struct libnormalform_function {
	/**
	 * Function that is used to evaluate the trueness of something
	 * 
	 * @param   user_data  `.user_data`
	 * @param   input      Input to the function, normally it will
	 *                     be `NULL`, but it is inside the antecedent
	 *                     for a qualifier, it will be the `.key`
	 *                     for some `struct libnormalform_mapping`,
	 *                     and if it is inside the predicate of a
	 *                     qualifier, it will be the `.value`
	 *                     for some `struct libnormalform_mapping`
	 * @return             1 if the function is true,
	 *                     0 if the function is false,
	 *                     -1 on failure (the function may set `errno`)
	 * 
	 * For `libnormalform_exists`, `libnormalform_nexists`,
	 * and `libnormalform_unique`, it will only be called
	 * for the `.key` for `struct libnormalform_mapping`'s
	 * 
	 * For `libnormalform_universally`, `libnormalform_existentially`,
	 * and `libnormalform_uniquely`, it will only be called
	 * for the `.value` for `struct libnormalform_mapping`'s
	 */
	int (*evaluate)(void *user_data, void *input);

	/**
	 * Application-specific data that will be passed into
	 * `.evaluate` (making it reenterant so it can be called
	 * by multiple threads, or to configure the function)
	 * 
	 * May be `NULL`
	 */
	void *user_data;

	/**
	 * Identifier for function
	 *
	 * This need only be set when `libnormalform_to_string`
	 * is called. The value must be parsable by the application
	 * without any explicit termination
	 */
	const char *identifier;

	/**
	 * `NULL` or copy of of the object for `libnormalform_clone`
	 * 
	 * This field should normally be unset, but before calling
	 * `libnormalform_clone`, the application must set it
	 * either to `NULL` (if the clone can use the same reference)
	 * or to a clone of the variable.
	 */
	struct libnormalform_function *copy_for_clone;

	/**
	 * See `.requires_relaxation`
	 */
	struct libnormalform_function *relaxation;

	/**
	 * Before calling `libnormalform_express`, `libnormalform_dnf`,
	 * or `libnormalform_cnf` this shall be set to 0 if the function
	 * may keep the function as is, or to a non-0 value if it shall
	 * be replaced `.relaxation` or by TRUE if `.relaxation` is `NULL`
	 */
	int requires_relaxation;
};


/**
 * Generic function that can be referenced in a sentence
 * 
 * The function must be pure and distributive over any boolean operator
 * (it must be an endomorphism). That is, the output is always the
 * same for the same input without any side effects, and for any sentence
 * A * B, where * is any boolean operator and F is the function,
 * F(A * B) = F(A) * F(B).
 */
struct libnormalform_transformer {
	/**
	 * Function that is used to transform input
	 * 
	 * @param   user_data  `.user_data`
	 * @param   input      Input to the function, normally it will
	 *                     be `NULL`, but it is inside the antecedent
	 *                     for a qualifier, it will be the `.key`
	 *                     for some `struct libnormalform_mapping`,
	 *                     and if it is inside the predicate of a
	 *                     qualifier, it will be the `.value`
	 *                     for some `struct libnormalform_mapping`,
	 *                     except that during the create of a
	 *                     `struct libnormalform_term`, the library
	 *                     may insert builtin transformers that will
	 *                     have the `struct libnormalform_mapping *`
	 *                     as input and will output the `.key` or
	 *                     `.value`
	 * @return             The transformation of `input` (not `NULL`),
	 *                     `NULL` on failure (the function may set `errno`)
	 * 
	 * For `libnormalform_exists`, `libnormalform_nexists`,
	 * and `libnormalform_unique`, it will only be called
	 * for the `.key` for `struct libnormalform_mapping`'s
	 * 
	 * For `libnormalform_universally`, `libnormalform_existentially`,
	 * and `libnormalform_uniquely`, it will only be called
	 * for the `.value` for `struct libnormalform_mapping`'s
	 */
	void *(*transform)(void *user_data, void *input);

	/**
	 * The function is called when the output of `.transform`
	 * is not longer needed by the library
	 * 
	 * May be `NULL`
	 * 
	 * This function is not called if `.transform` output `NULL`
	 * 
	 * @param  user_data  `.user_data`
	 * @param  output     The pointer that was returned by `.transform`
	 */
	void (*deallocate)(void *user_data, void *output);

	/**
	 * Application-specific data that will be passed into
	 * `.transform` and `.deallocate` (making them reenterant
	 * so it can be called by multiple threads, or to
	 * configure the function)
	 * 
	 * May be `NULL`
	 */
	void *user_data;

	/**
	 * Identifier for function
	 *
	 * This need only be set when `libnormalform_to_string`
	 * is called. The value must be parsable by the application
	 * without any explicit termination
	 */
	const char *identifier;

	/**
	 * `NULL` or copy of of the object for `libnormalform_clone`
	 * 
	 * This field should normally be unset, but before calling
	 * `libnormalform_clone`, the application must set it
	 * either to `NULL` (if the clone can use the same reference)
	 * or to a clone of the variable.
	 */
	struct libnormalform_transformer *copy_for_clone;

	/**
	 * Before calling `libnormalform_express`, `libnormalform_dnf`,
	 * or `libnormalform_cnf` this shall be set to 0 if the function
	 * may keep the function, or to a non-0 value if it shall
	 * be replaced with a tautology
	 */
	int requires_elimination;

	/**
	 * This field will automatically be set to `LIBNORMALFORM_NOT_BUILT_IN`
	 * to indicated that the object originates in the application,
	 * however a `struct libnormalform_term *` created by the library
	 * (via `libnormalform_express`, `libnormalform_dnf`, or
	 * `libnormalform_cnf`) can contain objects with other values in this
	 * field, to describe what it does. In particular, depending on the
	 * flags used when creating the `struct libnormalform_term *`,
	 * qualification sentences may contain `LIBNORMALFORM_DOMAIN_VIEW`
	 * and `LIBNORMALFORM_IMAGE_VIEW` and transformers.
	 */
	enum libnormalform_builtin_transformer builtin;
};


/**
 * Key–value pair
 */
struct libnormalform_mapping {
	/**
	 * Key
	 * 
	 * In mapped qualifiers (`libnormalform_all`,
	 * `libnormalform_any`, `libnormalform_one`), this
	 * is used as the input for the antecedent
	 * 
	 * In unmapped qualifiers (`libnormalform_exists`,
	 * `libnormalform_nexists`, `libnormalform_unique`),
	 * is this used as the input for the predicate
	 * 
	 * In premapped qualifiers (`libnormalform_universally`,
	 * `libnormalform_existentially`, `libnormalform_uniquely`),
	 * is this unused
	 * 
	 * Unused for domain size checks (`libnormalform_empty`,
	 * `libnormalform_nonempty`, `libnormalform_singleton`)
	 */
	void *key;

	/**
	 * Value
	 * 
	 * In mapped qualifiers (`libnormalform_all`,
	 * `libnormalform_any`, `libnormalform_one`), this
	 * is used as the input for the predicate
	 * 
	 * In unmapped qualifiers (`libnormalform_exists`,
	 * `libnormalform_nexists`, `libnormalform_unique`),
	 * is this unused
	 * 
	 * In premapped qualifiers (`libnormalform_universally`,
	 * `libnormalform_existentially`, `libnormalform_uniquely`),
	 * is this used as the input for the predicate
	 * 
	 * Unused for domain size checks (`libnormalform_empty`,
	 * `libnormalform_nonempty`, `libnormalform_singleton`)
	 */
	void *value;
};


/**
 * Domain of interest for qualifiers
 */
struct libnormalform_map {
	/**
	 * Associative array over values in the domain
	 */
	struct libnormalform_mapping *mappings;

	/**
	 * The number of elements in `.mappings`
	 */
	size_t nmappings;

	/**
	 * Application-specific data that the application
	 * could use to identify the domain
	 * 
	 * May be `NULL`
	 */
	void *user_data;

	/**
	 * Identifier for domain
	 *
	 * This need only be set when `libnormalform_to_string`
	 * is called. The value must be parsable by the application
	 * without any explicit termination
	 */
	const char *identifier;

	/**
	 * `NULL` or copy of of the object for `libnormalform_clone`
	 * 
	 * This field should normally be unset, but before calling
	 * `libnormalform_clone`, the application must set it
	 * either to `NULL` (if the clone can use the same reference)
	 * or to a clone of the variable.
	 */
	struct libnormalform_map *copy_for_clone;
};


struct libnormalform_atom_comparsion {
	int version;
	enum libnormalform_sentences_relationship relationship;
};

struct libnormalform_domain_comparsion {
	int version;
	enum libnormalform_domain_relationship relationship;
};

struct libnormalform_analysers { /* TODO doc */
	void *user_data;
	int (*compare_variable_to_variable)(void *user_data, struct libnormalform_atom_comparsion *result,
	                                    struct libnormalform_variable *left, struct libnormalform_variable *right);
	int (*compare_function_to_function)(void *user_data, struct libnormalform_atom_comparsion *result,
	                                    struct libnormalform_function *left, struct libnormalform_function *right);
	int (*compare_variable_to_function)(void *user_data, struct libnormalform_atom_comparsion *result,
	                                    struct libnormalform_variable *left, struct libnormalform_function *right);
	int (*compare_domains)(void *user_data, struct libnormalform_domain_comparsion *result,
	                       struct libnormalform_map *left, struct libnormalform_map *right);
};


/**
 * Qualifier
 */
struct libnormalform_qualification {
	struct libnormalform_map *map;          /**< The domain of interest */
	struct libnormalform_term *antecedent;  /**< The antecedent, `NULL` if joined with the predicate */
	struct libnormalform_term *predicate;   /**< The predicate */
};


/**
 * Clause of terms
 */
struct libnormalform_clause {
	struct libnormalform_term *terms;  /**< The terms in the clause */
	size_t nterms;                     /**< The number of terms in the clause */
};


/**
 * Transformater function with input
 */
struct libnormalform_transformation {
	struct libnormalform_transformer *transformer;  /**< The transformer function */
	struct libnormalform_term *sentence;            /**< The sentence the transformation is over */
};


/**
 * Application-readable sentence
 */
struct libnormalform_term {
	/**
	 * The type of the clause, qualifier, literal, or transformation
	 */
	enum libnormalform_term_type type;

	/**
	 * Whether the term or own of its subterms have been reduced;
	 */
	int reduced;

	/**
	 * The description of the sentence
	 */
	union {
		/**
		 * Use if `.type` is `LIBNORMALFORM_DISJUNCTION`
		 */
		struct libnormalform_clause disjunction;

		/**
		 * Use if `.type` is `LIBNORMALFORM_CONJUNCTION`
		 */
		struct libnormalform_clause conjunction;

		/**
		 * Use if `.type` is `LIBNORMALFORM_EXCLUSIVE_DISJUNCTION`
		 */
		struct libnormalform_clause exclusive_disjunction;

		/**
		 * Use if `.type` is `LIBNORMALFORM_DISJUNCTION`,
		 * `LIBNORMALFORM_CONJUNCTION`, or
		 * `LIBNORMALFORM_EXCLUSIVE_DISJUNCTION`
		 */
		struct libnormalform_clause clause;

		/**
		 * Use if `.type` is `LIBNORMALFORM_TRANSFORMATION`
		 */
		struct libnormalform_transformation transformation;

		/**
		 * Use if `.type` is `LIBNORMALFORM_VARIABLE` or
		 * `LIBNORMALFORM_NEGATED_VARIABLE`
		 */
		struct libnormalform_variable *variable;

		/**
		 * Use if `.type` is `LIBNORMALFORM_FUNCTION` or
		 * `LIBNORMALFORM_NEGATED_FUNCTION`
		 */
		struct libnormalform_function *function;

		/**
		 * Use if '.type` is `LIBNORMALFORM_FOR_ALL` or
		 * `LIBNORMALFORM_NEGATED_FOR_ALL`
		 */
		struct libnormalform_qualification for_all;

		/**
		 * Use if '.type` is `LIBNORMALFORM_FOR_ANY` or
		 * `LIBNORMALFORM_NEGATED_FOR_ANY`
		 */
		struct libnormalform_qualification for_any;

		/**
		 * Use if '.type` is `LIBNORMALFORM_FOR_ONE` or
		 * `LIBNORMALFORM_NEGATED_FOR_ONE`
		 */
		struct libnormalform_qualification for_one;

		/**
		 * Use if '.type` is `LIBNORMALFORM_FOR_ALL`,
		 * `LIBNORMALFORM_NEGATED_FOR_ALL`, `LIBNORMALFORM_FOR_ANY`,
		 * `LIBNORMALFORM_NEGATED_FOR_ANY`, `LIBNORMALFORM_FOR_ONT`,
		 * or `LIBNORMALFORM_NEGATED_FOR_ONE`
		 */
		struct libnormalform_qualification qualification;
	} term;
};





/**
 * Increase the reference count of a sentence object by 1
 * 
 * @param   this  The sentence object
 * @return        `this` on success, `NULL` on failure
 * 
 * @throws  ENOMEM  The reference count is already maximised (at SIZE_MAX)
 * 
 * Reasonable application can safely assume that `this` is always returned
 * 
 * Note, `NULL` is returned without `errno` modified if `this` is `NULL`
 * 
 * Be aware that this function is not thread-safe
 * 
 * @seealso  libnormalform_clone
 * @seealso  libnormalform_free
 */
LIBNORMALFORM_SENTENCE *(libnormalform_ref)(LIBNORMALFORM_SENTENCE *this);


/**
 * Create a copy of a sentence object
 * 
 * This may be necessary as usage of sentence objects are not thread-safe,
 * creating a copy of a sentence object will allow one thread to safely
 * use one copy and another thread the other copy
 * 
 * Before calling this function, the application shall set `.copy_for_clone`
 * in each `struct libnormalform_variable`, `struct libnormalform_function`,
 * `struct libnormalform_map` and `struct libnormalform_transformer`, used
 * by the sentence. `.copy_for_clone` shall either be set to `NULL` or a copy
 * of object. If `NULL` is used, the copy of `this` will use the same
 * instance of the object as `this`.
 * 
 * @param   this  The sentence object
 * @return        A unique pointer on success or `NULL` if
 *                `this` is `NULL`; `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create a copy of `this`
 * 
 * Be aware that this function is not thread-safe
 * 
 * @seealso  libnormalform_ref
 * @seealso  libnormalform_free
 */
LIBNORMALFORM_USE_RESULT__
LIBNORMALFORM_SENTENCE *(libnormalform_clone)(LIBNORMALFORM_SENTENCE *this);


/**
 * When `this` is a `LIBNORMALFORM_SENTENCE *`:
 * 
 *     Decrease the reference count of a sentence object by 1, 
 *     if the object reference count reaches 0, deallocate the
 *     object.
 * 
 *     Because all functions that return a new sentence object
 *     (excluding `libnormalform_clone`), adopt the ownership
 *     of the reference to each input sentence (and may create
 *     it's own subsentences), this function is called recursively,
 *     and the application shall not attempt to call this function
 *     for sentences used to create other sentences
 * 
 *     Be aware the this function will not deallocate any
 *     `struct libnormalform_variable *`,
 *     `struct libnormalform_function *`, or
 *     `struct libnormalform_map *` used in the sentence as
 *     these are owned any managed by the application
 * 
 * When `this` is a `struct libnormalform_term *`:
 * 
 *     Recursively deallocate `this`. This will only deallocate
 *     `this` and subobjects with the same type
 * 
 *     If `.type` is invalid for `this` or any subobject, the
 *     function's behaviour is undefined
 * 
 * This function is a no-operation function when `this` is `NULL`
 * 
 * @param   this  The object
 * 
 * This function's behaviour is undefined if `this` is not `NULL`
 * but not of the one of the above listed types
 * 
 * Be aware that this function is not thread-safe
 */
void (libnormalform_free)(void *this);


/**
 * Evaluate a sentence to determine it's trueness
 * 
 * Before calling this function, the application code shall
 * configure any `struct libnormalform_variable`,
 * `struct libnormalform_function`, and `struct libnormalform_map`
 * used by the sentence. For each `struct libnormalform_variable`,
 * `.value` shall either be set to `LIBNORMALFORM_TRUE` or
 * `LIBNORMALFORM_FALSE` to indicate the value of the atom.
 * For each `struct libnormalform_function`, `.evaluate` shall
 * be set to a pointer to function that evaluates the input and
 * `.user_data` shall be set to any application data the function
 * needs to operate; `.evaluate` shall return 1, 0, or -1 as
 * specified for this function; and may set `errno` to indicate
 * an error (library itself does not look at `errno`, but may
 * be used to signal the error to the application, of course
 * the error may also be specified to the application in an
 * application-specific way). For each `struct libnormalform_map`,
 * `.mappings` shall be to the associated array of values
 * that shall be tested by the qualifier-sentence it is
 * used by, and `.nmappings` shall be set to the number of
 * pairs in this array.
 * 
 * @param   this  The sentence to evaluate
 * @return        1 if the sentence is true,
 *                0 if the sentence is false,
 *                -1 on failure
 * 
 * Only application code may cause this function to
 * fail, therefore no error codes are predefined for
 * this function, instead `errno` is only set by
 * the failing application code
 * 
 * Be aware that this function is not thread-safe
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
int (libnormalform_evaluate)(LIBNORMALFORM_SENTENCE *this);





/**
 * Return an application readable expression of a statement in negation
 * normal form, optionally with XOR, and reduce the statement to a
 * statement that is at least as true (but as false as possible), and
 * is minimised, according what the application specifies that it can
 * work with
 * 
 * Before calling this function, the application shall set `.relaxation`
 * `.requires_relaxation` in each `struct libnormalform_function` used
 * used by the sentence. `.requires_relaxation` may be set as 0 if the
 * function shall not be replaced (in this case `.relaxation` need not
 * be set), but set to 1 if the function most be replaced with a more
 * true function. In the latter case, `.relaxation` shall either be set
 * to the new function or to `NULL`; if set to null, the function is
 * reduced to a tautological sentence. For any `libnormalform_transformer`
 * it must also set `.requires_elimination` to 1 if the transformation
 * must be replaces with a tautology, and 0 otherwise.
 * 
 * @param   this       The sentence to describe
 * @param   flags      The bitwise OR of any number of the following values:
 *                     - LIBNORMALFORM_AVOID_FOR_ALL:                   Prefer ¬∃x.¬φ over ∀x.φ
 *                     - LIBNORMALFORM_AVOID_NEGATED_FOR_ALL:           Prefer  ∃x.¬φ over ¬∀x.φ
 *                     - LIBNORMALFORM_AVOID_FOR_ANY:                   Prefer ¬∀x.¬φ over ∃x.φ
 *                     - LIBNORMALFORM_AVOID_NEGATED_FOR_ANY:           Prefer  ∀x.¬φ over ¬∃x.φ
 *                     - LIBNORMALFORM_RELAX_FOR_ONE:                   Relax any positive ∃!x.φ into ∃x.φ
 *                     - LIBNORMALFORM_REDUCE_XOR:                      Do not use XOR in the returned statement,
 *                                                                      but transform it to negation normal form
 *                     - LIBNORMALFORM_JOIN_SIDES_IN_FOR_ALL            Express   φ(x)∀x:θ(x)   on the form  ∀x.(θ(x) → φ(x))
 *                     - LIBNORMALFORM_JOIN_SIDES_IN_NEGATED_FOR_ALL    Express ¬(φ(x)∀x:θ(x))  on the form ¬∀x.(θ(x) → φ(x))
 *                     - LIBNORMALFORM_JOIN_SIDES_IN_FOR_ANY            Express   φ(x)∃x:θ(x)   on the form  ∃x.(θ(x) ∧ φ(x))
 *                     - LIBNORMALFORM_JOIN_SIDES_IN_NEGATED_FOR_ANY    Express ¬(φ(x)∃x:θ(x))  on the form ¬∃x.(θ(x) ∧ φ(x))
 *                     - LIBNORMALFORM_JOIN_SIDES_IN_FOR_ONE            Express   φ(x)∃!x:θ(x)  on the form  ∃!x.(θ(x) ∧ φ(x))
 *                     - LIBNORMALFORM_JOIN_SIDES_IN_NEGATED_FOR_ONE    Express ¬(φ(x)∃!x:θ(x)) on the form ¬∃!x.(θ(x) ∧ φ(x))
 *                     - LIBNORMALFORM_ELIMINATE_FOR_ALL                Relax any non-translatable  ∀x.φ to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_NEGATED_FOR_ALL        Relax any non-translatable ¬∀x.φ to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_FOR_ANY                Relax any non-translatable  ∃x.φ to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_IN_NEGATED_FOR_ANY     Relax any non-translatable ¬∃x.φ to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_IN_FOR_ONE             Relax any non-translatable ∃!x.φ to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_IN_NEGATED_FOR_ONE     Relax any ¬∃!x.φ to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_VARIABLE               Relax any positive variable literal to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_NEGATED_VARIABLE       Relax any negative variable literal to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_FUNCTION               Relax any positive function literal to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_NEGATED_FUNCTION       Relax any negative function literal to ⊤
 *                     - LIBNORMALFORM_ELIMINATE_XOR                    Remove all XOR's (nullified by `LIBNORMALFORM_REDUCE_XOR`)
 * @param   analysers  Application provided functions to help reduce the statement, or `NULL`
 * @return             The description of the sentence, `NULL` on failure;
 *                     the returned pointer shall be deallocated with
 *                     `libnormalform_free` when it is no longer needed
 * 
 * @seealso  libnormalform_dnf
 * @seealso  libnormalform_cnf
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_FREE_WITH__(libnormalform_free) LIBNORMALFORM_ONE_NONNULL_INPUT__(1)
struct libnormalform_term *(libnormalform_express)(LIBNORMALFORM_SENTENCE *this, uint64_t flags, /* TODO man */
                                                   const struct libnormalform_analysers *analysers);


/**
 * Variant of `libnormalform_express` that always canonicalises
 * the statement to disjunctive normal form
 * 
 * @param   this       The sentence to describe
 * @param   flags      See `libnormalform_express`; `LIBNORMALFORM_ELIMINATE_XOR`
 *                     is always applied, however `LIBNORMALFORM_REDUCE_XOR` is not,
 *                     but the user is adviced use `LIBNORMALFORM_REDUCE_XOR` unless
 *                     there is a risk that it would be too costly (EXPSPACE)
 * @param   analysers  Application provided functions to help reduce the statement, or `NULL`
 * @return             The description of the sentence, `NULL` on failure;
 *                     the returned pointer shall be deallocated with
 *                     `libnormalform_free` when it is no longer needed
 * 
 * @seealso  libnormalform_express
 * @seealso  libnormalform_cnf
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_FREE_WITH__(libnormalform_free) LIBNORMALFORM_ONE_NONNULL_INPUT__(1)
struct libnormalform_term *(libnormalform_dnf)(LIBNORMALFORM_SENTENCE *this, uint64_t flags, /* TODO */ /* TODO man */
                                               const struct libnormalform_analysers *analysers);


/**
 * Variant of `libnormalform_express` that always canonicalises
 * the statement to conjuctive normal form
 * 
 * @param   this       The sentence to describe
 * @param   flags      See `libnormalform_express`; `LIBNORMALFORM_ELIMINATE_XOR`
 *                     is always applied, however `LIBNORMALFORM_REDUCE_XOR` is not,
 *                     but the user is adviced use `LIBNORMALFORM_REDUCE_XOR` unless
 *                     there is a risk that it would be too costly (EXPSPACE)
 * @param   analysers  Application provided functions to help reduce the statement, or `NULL`
 * @return             The description of the sentence, `NULL` on failure;
 *                     the returned pointer shall be deallocated with
 *                     `libnormalform_free` when it is no longer needed
 * 
 * @seealso  libnormalform_express
 * @seealso  libnormalform_dnf
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_FREE_WITH__(libnormalform_free) LIBNORMALFORM_ONE_NONNULL_INPUT__(1)
struct libnormalform_term *(libnormalform_cnf)(LIBNORMALFORM_SENTENCE *this, uint64_t flags, /* TODO */ /* TODO man */
                                               const struct libnormalform_analysers *analysers);


/**
 * Convert a sentence object to a string that can be parsed
 * by `libnormalform_from_string` (and is somewhat human-readable)
 * 
 * Before calling this function, the application shall set `.identifier`
 * in each `struct libnormalform_variable`, `struct libnormalform_function`,
 * `struct libnormalform_map`, and `struct libnormalform_transformer` used
 * by the sentence to a non-`NULL`, unique string that identifies (but
 * does not necessarily describe) the object. The application must be able
 * to find the end of any such string without any explicit termination
 * (e.g., eithout there being a NUL-terminator)
 * 
 * Note that when a sentence is created, it is optimised and
 * reduced into fewer types of connetives (it's reducted into
 * negation normal form, except with XOR allowed, but not
 * necessarily to any canonical form) during construction,
 * so this function will not necessarily reproduce the sentence
 * as it was specified when it was constructed.
 * 
 * @param   this  The sentence object to serialise
 * @return        String-representation of `this`, `NULL` failure;
 *                the caller shall deallocate the returned pointer
 *                with free(3) when it is no longer needed
 *
 * @throws  ENOMEM  Insufficient memory available to serialise `this`
 * 
 * @seealso  libnormalform_from_string
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_USE_FREE__ LIBNORMALFORM_NONNULL_INPUT__
char *(libnormalform_to_string)(LIBNORMALFORM_SENTENCE *this);


/**
 * Convert a string, created with `libnormalform_to_string`
 * (or is on similar form), to sentence object
 * 
 * The string shall be on the whitespace-insensitive form:
 * 
 *     constant         ::= "TRUE" | "FALSE";
 *     connective1      ::= "NOT";
 *     connective2      ::= "AND" | "OR" | "XOR" | "IF" | "IMPLY" |
 *                          "NAND" | "NOR" | "XNOR" | "NIF" | "NIMPLY";
 *     qualifier0       ::= "EMPTY" | "NONEMPTY" | "SINGLETON";
 *     qualifier1       ::= "EXISTS" | "NEXISTS" | "UNIQUE" |
 *                          "EXISTENTIALLY" | "UNIVERSALLY" | "UNIQUELY";
 *     qualifier2       ::= "ALL" | "ANY" | "ONE";
 *     unary            ::= connective1 [reference-point] "(" sentence ")";
 *     variadic         ::= connective2 [reference-point] "(" [sentence-list] ")";
 *     sentence-list    ::= sentence ["," sentence-list];
 *     qualified0       ::= qualifier0 [reference-point] "(" map ")";
 *     qualified1       ::= qualifier1 [reference-point] "(" map "," sentence ")";
 *     qualified2       ::= qualifier2 [reference-point] "(" map "," sentence "," sentence ")";
 *     atom             ::= atom-var | atom-fun;
 *     atom-var         ::= "VARIABLE" [reference-point] "(" variable ")";
 *     atom-fun         ::= "FUNCTION" [reference-point] "(" function ")";
 *     transformation   ::= "TRANSFORMATION" [reference-point] "(" transformer "," sentence ")";
 *     reference-point  ::= "@" decimal-number;
 *     reference        ::= "REF(" decimal-number ")";
 *     one-to-nine      ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
 *     zero-to-nine     ::= "0" | one-to-nine;
 *     decimal-number   ::= "0" | positive-decimal;
 *     positive-decimal ::= one-to-nine [digits];
 *     digits           ::= zero-to-nine [digits];
 *     sentence         ::= constant | unary | variadic | qualified0 | qualified1 |
 *                          qualified2 | atom | transformation | reference;
 * 
 * where "sentence" is the root, and where "map" is parsed by `*spec->get_map`,
 * "variable" is parsed by `*spec->get_variable`, "function" is parsed by
 * `*spec->get_function`, and "transformer" is parsed by `*spec->get_transformer`.
 * References must start at 0 and increment by one, in left-to-right order,
 * every time reference point is specified, and forward-references are not allowed
 * (this includes reference to containing sentence (whose reference ID is lower
 * because it is written earlier)).
 * 
 * @param   s        The representation of the sentence to deserialise
 * @param   end_out  Output parameter for the end of `s`;
 *                   if `NULL` the function will fail if `s` contains
 *                   excess information
 * @param   spec     Specification for how application managed objects
 *                   are to be deserialise
 * @return           A unique pointer, that is a deserialisation of `s`,
 *                   or `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to deserialise `s`
 * @throws  EINVAL  `s` was not properly formatted
 * @throws  EINVAL  `end_out` was `NULL` and `s` containd excess information
 * @throws  EDOM    `s` contained a empty clause for a connective
 *                  that does not support empty clauses
 * @throws  EDOM    `s` contained a transformation over a qualifer
 * @throws  ENOENT  `s` contained a variable but `spec->get_variable` was `NULL`
 * @throws  ENOENT  `s` contained a boolean function but `spec->get_function` was `NULL`
 * @throws  ENOENT  `s` contained a domain but `spec->get_map` was `NULL`
 * @throws  ENOENT  `s` contained a transformation but `spec->get_transformer` was `NULL`
 * 
 * If function in `spec` fails, this function will fail and keep `errno`
 * as set by the function that failed
 * 
 * The function itself does not modify `s` and can operate on read-only
 * memory, however an offset of the string may be passed into application
 * code. The application is free to modify `s` if it knows the memory
 * is indeed writable.
 * 
 * @seealso  libnormalform_to_string
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_ONE_NONNULL_INPUT__(1) LIBNORMALFORM_ONE_NONNULL_INPUT__(3)
LIBNORMALFORM_SENTENCE *(libnormalform_from_string)(char *s, char **end_out, const struct libnormalform_representation_spec *spec);





/**
 * Create an atomic sentence whose value is externally set
 * 
 * @param   variable  The variable the sentence shall express
 * @return            A sentence object referencing `variable`, `NULL` on failure
 * @throws  ENOMEM    Insufficient memory available to create the sentence
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_variable)(struct libnormalform_variable *variable);


/**
 * Create an atomic sentence whose value is externally evaluated
 * 
 * @param   function  The function the sentence shall express
 * @return            A sentence object referencing `function`, `NULL` on failure
 * @throws  ENOMEM    Insufficient memory available to create the sentence
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_function)(struct libnormalform_function *function);


/**
 * Create an endomorphic transformation of the input for a sentence
 *
 * `function->builtin` will automatically be initialised to `LIBNORMALFORM_NOT_BUILT_IN`
 * 
 * @param   function  The transformation function
 * @param   sentence  The sentence whose input shall be transformed
 * @return            A sentence whose input is transformed by `function`, `NULL` on failure
 * @throws  ENOMEM    Insufficient memory available to create the sentence
 * @throws  EDOM      `sentence` is a qualifier
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_ONE_NONNULL_INPUT__(1)
LIBNORMALFORM_SENTENCE *(libnormalform_transformation)(struct libnormalform_transformer *function, LIBNORMALFORM_SENTENCE *sentence);


/**
 * TRUE: Tautology
 *
 * Always true
 *
 * Commonly written "⊤", "1", or "T"
 * 
 * @return            An atomic sentence with a constant value of True, `NULL` on failure
 * @throws  ENOMEM    Insufficient memory available to create the sentence
 */
LIBNORMALFORM_USE_RESULT__
LIBNORMALFORM_SENTENCE *(libnormalform_true)(void);


/**
 * FALSE: Contradiction
 * 
 * Always false
 * 
 * Commonly written "⊥", "1", or "F"
 * 
 * @return            An atomic sentence with a constant value of False, `NULL` on failure
 * @throws  ENOMEM    Insufficient memory available to create the sentence
 */
LIBNORMALFORM_USE_RESULT__
LIBNORMALFORM_SENTENCE *(libnormalform_false)(void);


/**
 * NOT: Negation
 *
 * The condition must not be met:
 * ¬0 = 1
 * ¬1 = 0
 *
 * Properties:
 * -  Involution
 * -  Distribution over AND changes connective to OR (De Morgan's law)
 * -  Distribution over OR changes connective to AND (De Morgan's law)
 * 
 * Commonly written "¬" ("¬x"), "~", or "!", or with overstroke
 * 
 * @param   x  The sentence that should be negated;
 *             ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `x` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `x` to
 * be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
LIBNORMALFORM_SENTENCE *(libnormalform_not)(LIBNORMALFORM_SENTENCE *x);


/**
 * FOR ALL: Universal quantification (mapped)
 * 
 * The predicate must be met for every element that the antecedent
 * is met for; if no element exists, or the antecedent is false for
 * every element, the sentence is true
 * 
 * Properties:
 * -  Vacuous truth
 * -  ∀x∈D.P(x) → ⊤ = ⊤
 * -  ∀x∈D.⊥ → Q(x) = ⊤
 * -  ∀x∈D.⊤ → ⊥ ⊨ D = ∅
 * -  Conjunction
 * 
 * Commonly written "∀" ("∀x∈d.k(x) → v(x)", "∀x∈d (k(x) → v(x))", or "v(x) ∀ x∈d : k(x)")
 * 
 * The antecedent is tested for every `.key` in the domain,
 * and the predicate is tested for every associated `.value`
 * where the antecedent is met; but the testing is cut short
 * if the antecedent is met and not the predicate for an element
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   k  The antecedent; ownership is transfered to this function
 * @param   v  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `k` or `v` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `k` or
 * `v` to be `NULL`)
 * 
 * @seealso  libnormalform_nexists
 * @seealso  libnormalform_universally
 * @seealso  libnormalform_any
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_ONE_NONNULL_INPUT__(1)
LIBNORMALFORM_SENTENCE *(libnormalform_all)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *k, LIBNORMALFORM_SENTENCE *v);


/**
 * THERE EXISTS: Existential quantification (mapped)
 * 
 * The predicate must be met for at least one element that the
 * antecedent is met for; if no element exists, or the antecedent is
 * false for every element, the sentence is false
 * 
 * Properties:
 * -  Vacuous falsity
 * -  ∃x∈D.P(x) ∧ ⊥ = ⊥
 * -  ∃x∈D.⊥ ∧ Q(x) = ⊥
 * -  ∃x∈D.⊤ ∧ ⊤ ⊨ D ⊃ ∅
 * -  Disjunction
 * 
 * Commonly written "∃" ("∃x∈d.k(x) ∧ v(x)", "∃x∈d (k(x) ∧ v(x))", or "v(x) ∃ x∈d : k(x)")
 * 
 * The antecedent is tested for every `.key` in the domain,
 * and the predicate is tested for every associated `.value`
 * where the antecedent is met; but the testing is cut short
 * if both the antecedent and predicate is met for an element
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   k  The antecedent; ownership is transfered to this function
 * @param   v  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `k` or `v` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `k` or
 * `v` to be `NULL`)
 * 
 * @seealso  libnormalform_exists
 * @seealso  libnormalform_existentially
 * @seealso  libnormalform_one
 * @seealso  libnormalform_all
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_ONE_NONNULL_INPUT__(1)
LIBNORMALFORM_SENTENCE *(libnormalform_any)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *k, LIBNORMALFORM_SENTENCE *v);


/**
 * THERE EXISTS ONE: Unique existential quantification (mapped)
 * 
 * The predicate must be met for exactly one element that the
 * antecedent is met for; if no element exists, or the antecedent is
 * false for every element, the sentence is false
 * 
 * Properties:
 * -  Vacuous falsity
 * -  ∃!x∈D.P(x) ∧ ⊥ = ⊥
 * -  ∃!x∈D.⊥ ∧ Q(x) = ⊥
 * -  ∃!x∈D.⊤ ∧ ⊤ ⊨ |D| = 1
 * 
 * Commonly written "∃!" ("∃!x∈d.k(x) ∧ v(x)", "∃!x∈d (k(x) ∧ v(x))", or "v(x) ∃! x∈d : k(x)")
 * 
 * The antecedent is tested for every `.key` in the domain,
 * and the predicate is tested for every associated `.value`
 * where the antecedent is met; but the testing is cut short
 * if both the antecedent and predicate is met for two elements
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   k  The antecedent; ownership is transfered to this function
 * @param   v  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `k` or `v` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `k` or
 * `v` to be `NULL`)
 * 
 * @seealso  libnormalform_unique
 * @seealso  libnormalform_uniquely
 * @seealso  libnormalform_any
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_ONE_NONNULL_INPUT__(1)
LIBNORMALFORM_SENTENCE *(libnormalform_one)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *k, LIBNORMALFORM_SENTENCE *v);





/**
 * AND: Conjunction
 *
 * Also known as BUT
 * 
 * All conditions must be met
 * 
 * 0 ∧ 0 = 0
 * 0 ∧ 1 = 0
 * 1 ∧ 0 = 0
 * 1 ∧ 1 = 1
 * 
 * Properties:
 * -  Vacuous truth
 * -  Identity singleton
 * -  Commutative
 * -  Associative
 * -  Distributive over OR
 * -  Distributive over XOR
 * -  ⊤ as identity
 * -  Dominated by ⊥
 * -  Idempotent
 * -  Connecting complement results in contradiction
 * -  More lax term is absorbed (A ∧ (A ∨ B) simplifies to A)
 * 
 * Commonly written "∧" ("⋀" if n-ary), "&", or with juxtaposition
 * 
 * @param   xs  `NULL`-terminated list of sentences that should be
 *              joined by the connective AND; this can be any number
 *              of arguments, even none; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_AND
 * @seealso  libnormalform_and_checked
 * @seealso  libnormalform_andl_checked
 * @seealso  libnormalform_vand_checked
 * @seealso  libnormalform_andl
 * @seealso  libnormalform_vand
 * @seealso  libnormalform_and2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_and)(LIBNORMALFORM_SENTENCE **xs);


/**
 * OR: Disjunction
 * 
 * Also known as Inclusive disjunction
 * 
 * At least one condition must be met
 * 
 * 0 ∨ 0 = 0
 * 0 ∨ 1 = 1
 * 1 ∨ 0 = 1
 * 1 ∨ 1 = 1
 * 
 * Properties:
 * -  Vacuous falsity
 * -  Identity singleton
 * -  Commutative
 * -  Associative
 * -  Distributive over AND
 * -  ⊥ as identity
 * -  Dominated by ⊤
 * -  Idempotent
 * -  Connecting complement results in tautology
 * -  More strict term is absorbed (A ∨ (A ∧ B) simplifies to A)
 * 
 * Commonly written "∨" ("⋁" if n-ary), "|", or "+"
 * 
 * @param   xs  `NULL`-terminated list of sentences that should be
 *              joined by the connective OR; this can be any number
 *              of arguments, even none; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_OR
 * @seealso  libnormalform_or_checked
 * @seealso  libnormalform_orl_checked
 * @seealso  libnormalform_vor_checked
 * @seealso  libnormalform_orl
 * @seealso  libnormalform_vor
 * @seealso  libnormalform_or2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_or)(LIBNORMALFORM_SENTENCE **xs);


/**
 * XOR: Exclusive disjunction
 * 
 * Also known as EOR, EXOR, NEQ, NIFF, Parity (especially when n-ary),
 * Exclusive alternation, Exclusive or, Logical non-equivalence,
 * Logical non-equivalence, Logical inequality, Not if and only if,
 * or Unless and only unless
 * 
 * An odd number of conditions must be met
 * 
 * 0 ⊕ 0 = 0
 * 0 ⊕ 1 = 1
 * 1 ⊕ 0 = 1
 * 1 ⊕ 1 = 0
 * 
 * Properties:
 * -  Vacuous falsity
 * -  Identity singleton
 * -  Commutative
 * -  Associative
 * -  ⊥ as identity
 * -  Complemented by ⊤
 * -  Annihiliation by reflextion
 * -  Connecting complement results in tautology
 * -  A ⊕ B is reduced to (A ∨ B) ∧ (¬A ∨ ¬B) or
 *    (A ∧ ¬B) ∨ (¬A ∧ B) in negation normal form
 * 
 * Commonly written "⊕" ("⨁" if n-ary), "⊻", "↮", "⇎", "≢", or "^"
 * 
 * Note that the name Exclusive disjunction is misleading
 * when there are more than two terms, as the statement
 * will not check that exactly one term is true, but rather
 * calculate the parity of the terms.
 * 
 * @param   xs  `NULL`-terminated list of sentences that should be
 *              joined by the connective XOR; this can be any number
 *              of arguments, even none; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_XOR
 * @seealso  libnormalform_xor_checked
 * @seealso  libnormalform_xorl_checked
 * @seealso  libnormalform_vxor_checked
 * @seealso  libnormalform_xorl
 * @seealso  libnormalform_vxor
 * @seealso  libnormalform_xor2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_xor)(LIBNORMALFORM_SENTENCE **xs);


/**
 * IF: Converse implication
 * 
 * Also known as Converse conditional
 * 
 * Creates a chain where any condition must be at least
 * as satisfied as the condition left to it (xs[0] ≤ xs[1])
 * (Not xs[1] without xs[0]); it is false only when only
 * the left-most term is false
 * 
 * 0 ← 0 = 1
 * 0 ← 1 = 0
 * 1 ← 0 = 1
 * 1 ← 1 = 1
 * 
 * Properties:
 * -  Identity singleton
 * -  Non-commutative
 * -  Left-associative: A ← B ← C = (A ← B) ← C ≠ A ← (B ← C)
 * -  Complemented by left ⊥
 * -  Dominated by left ⊤
 * -  Right falsity results in tautology
 * -  ⊤ as right identity
 * -  Contrapositivity: A ← B = ¬B ← ¬A
 * -  Transitive: (A ← B) ∧ (B ← C) ⊨ A ← C
 * -  Reflexive: A ← A = ⊤
 * -  Complete: (A ← B) ∨ (B ← A) = ⊤
 * -  Excluded middle: (A ← B) ∨ (¬A ← B) = ⊤
 * -  Import-export: (A ← B) ← C = A ← (B ∧ C)
 * -  Commutativity of antecedents: (A ← B) ← C = (A ← C) ← B
 * -  Vacuous conditional: ¬A ⊨ B ← A
 * -  Antecedent strengthening: A ← B ⊨ A ← (B ∧ C)
 * -  Right-distributive: (A ← B) ← C = (A ← C) ← (B ← C)
 * -  Distributive over left AND
 * -  Distributive over left OR
 * -  Distributing over right AND changes AND to OR
 * -  Distributing over right OR changes OR to AND
 * -  A ← B is reduced to A ∨ ¬B in negation normal form
 * 
 * Commonly written "←", "⇐", "<-", "<=", "≤", "⩽", or "⊂"
 * 
 * @param   xs  `NULL`-terminated list of sentences that should be
 *              joined by the connective IF; this can be any positive
 *              number of arguments; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * @throws  EDOM    `xs` contains no term (but only `NULL`)
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_IF
 * @seealso  libnormalform_if_checked
 * @seealso  libnormalform_ifl_checked
 * @seealso  libnormalform_vif_checked
 * @seealso  libnormalform_ifl
 * @seealso  libnormalform_vif
 * @seealso  libnormalform_if2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_if)(LIBNORMALFORM_SENTENCE **xs);


/**
 * IMPLY: Material implication
 * 
 * Also known as IMPLIES, IF..THEN, NOT..WITHOUT or material conditional
 * 
 * Creates a chain where any condition must be at most
 * as satisfied as the condition left to it (xs[0] ≥ xs[1])
 * (Not xs[0] without xs[1]); it is false only when only
 * the right-most term is false
 * 
 * 0 → 0 = 1
 * 0 → 1 = 1
 * 1 → 0 = 0
 * 1 → 1 = 1
 * 
 * Properties:
 * -  Vacuous truth
 * -  Identity singleton
 * -  Non-commutative
 * -  Right-associative: A → B → C = A → (B → C) ≠ (A → B) → C
 * -  Complemented by right ⊥
 * -  Dominated by right ⊤
 * -  Left falsity results in tautology
 * -  ⊤ as left identity
 * -  Contrapositivity: A → B = ¬B → ¬A
 * -  Transitive: (A → B) ∧ (B → C) ⊨ A → C
 * -  Reflexive: A → A = ⊤
 * -  Complete: (A → B) ∨ (B → A) = ⊤
 * -  Excluded middle: (A → B) ∨ (A → ¬B) = ⊤
 * -  Import-export: A → (B → C) = (A ∧ B) → C
 * -  Commutativity of antecedents: A → (B → C) = B → (A → C)
 * -  Vacuous conditional: ¬A ⊨ A → B
 * -  Antecedent strengthening: A → B ⊨ (A ∧ C) → B
 * -  Left-distributive: A → (B → C) = (A → B) → (A → C)
 * -  Distributive over right AND
 * -  Distributive over right OR
 * -  Distributing over left AND changes AND to OR
 * -  Distributing over left OR changes OR to AND
 * -  A → B is reduced to ¬A ∨ B in negation normal form
 * 
 * Commonly written "→", "⇒", "->", "=>", ">=", "≥", "⩾", or "⊃"
 * 
 * @param   xs  `NULL`-terminated list of sentences that should
 *              be joined by the connective IMPLY; this can be any
 *              number of arguments; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_IMPLY
 * @seealso  libnormalform_imply_checked
 * @seealso  libnormalform_implyl_checked
 * @seealso  libnormalform_vimply_checked
 * @seealso  libnormalform_implyl
 * @seealso  libnormalform_vimply
 * @seealso  libnormalform_imply2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_imply)(LIBNORMALFORM_SENTENCE **xs);


/**
 * NAND: Alternative denial
 * 
 * Also known as Non-conjunction, Negated conjunction,
 * Mutual exclusion, or Sheffer stroke
 * 
 * Creates a left-associated NAND-chain; in NAND, the
 * two conditions must not be met at the same time
 * 
 * 0 ⊼ 0 = 1
 * 0 ⊼ 1 = 1
 * 1 ⊼ 0 = 1
 * 1 ⊼ 1 = 0
 *
 * There is no good interpretation for a NAND-chain
 * 
 * Commonly written "⊼", "↑", or as AND with the expression over-struck
 * 
 * Properties:
 * -  Identity singleton
 * -  Commutative (however A ⊼ B ⊼ C ≠ A ⊼ C ⊼ B due to non-associativity)
 * -  Left-associative: A ⊼ B ⊼ C = (A ⊼ B) ⊼ C ≠ A ⊼ (B ⊼ C)
 * -  Antireflexive: A ⊼ A = ⊥
 * -  Annihilated by ⊥: A ⊼ ⊥ = ⊤
 * -  Complemented by ⊤
 * -  Distributative over AND
 * -  A ⊼ B is reduced to ¬A ∨ ¬B in negation normal form
 * 
 * @param   xs  `NULL`-terminated list of sentences that should be
 *              joined by the connective NAND; this can be any positive
 *              number of arguments; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * @throws  EDOM    `xs` contains no term (but only `NULL`)
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_NAND
 * @seealso  libnormalform_nand_checked
 * @seealso  libnormalform_nandl_checked
 * @seealso  libnormalform_vnand_checked
 * @seealso  libnormalform_nandl
 * @seealso  libnormalform_vnand
 * @seealso  libnormalform_nand2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_nand)(LIBNORMALFORM_SENTENCE **xs);


/**
 * NOR: Joint denial
 * 
 * Also known as Non-disjunction, Negated disjunction, Peirce arrow,
 * Quine dagger, or Webb operator
 * 
 * Creates a left-associated NOR-chain; in NOR, the
 * two conditions must be unmet at same time
 * 
 * 0 ⊽ 0 = 1
 * 0 ⊽ 1 = 0
 * 1 ⊽ 0 = 0
 * 1 ⊽ 1 = 0
 * 
 * There is no good interpretation for a NOR-chain
 * 
 * Commonly written "⊽", "↓", or as OR with the expression over-struck
 * 
 * Properties:
 * -  Identity singleton
 * -  Commutative (however A ⊽ B ⊽ C ≠ A ⊽ C ⊽ B due to non-associativity)
 * -  Left-associative: A ⊽ B ⊽ C = (A ⊽ B) ⊽ C ≠ A ⊽ (B ⊽ C)
 * -  Anti-idempotent: A ⊽ A = ¬A
 * -  Annihilated by ⊤: A ⊽ ⊤ = ⊥
 * -  Complemented by ⊤
 * -  Distributing over AND changes AND to OR
 * -  Distributing over OR changes OR to AND
 * -  A ⊽ B is reduced to ¬A ∧ ¬B in negation normal form
 * 
 * @param   xs  `NULL`-terminated list of sentences that should be
 *              joined by the connective NOR; this can be any positive
 *              number of arguments; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * @throws  EDOM    `xs` contains no term (but only `NULL`)
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_NOR
 * @seealso  libnormalform_nor_checked
 * @seealso  libnormalform_norl_checked
 * @seealso  libnormalform_vnor_checked
 * @seealso  libnormalform_norl
 * @seealso  libnormalform_vnor
 * @seealso  libnormalform_nor2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_nor)(LIBNORMALFORM_SENTENCE **xs);


/**
 * XNOR: Logical bicondition
 * 
 * Also known as ENOR, EXNOR, NXOR, XAND, EQ, IFF, Exclusive NOR,
 * Material biconditional, Logical equivalence, Biimplication,
 * Bientailment, If and only if, Negated XOR, or Exclusive non-disjunction
 * 
 * Creates a left-associated XNOR-chain; in XNOR, the
 * two conditions must equally true
 * 
 * 0 ⊙ 0 = 1
 * 0 ⊙ 1 = 0
 * 1 ⊙ 0 = 0
 * 1 ⊙ 1 = 1
 * 
 * The interpretation of a XNOR-chain depends on it's length,
 * if it's length is even, is equivalent to XOR, otherwise,
 * it's its complement
 * 
 * Commonly written "⊙" ("⨀" if n-ary), "↔", "⇔", "≡", "==", or
 * as XOR with the expression over-struck
 * 
 * Properties:
 * -  Vacuous truth
 * -  Identity singleton
 * -  Commutative
 * -  Associative
 * -  ⊤ as identity
 * -  Complemented by ⊥
 * -  Reflexive: A ⊙ A = ⊤
 * -  Annihilated by ⊤: A ⊽ ⊤ = ⊥
 * -  Connecting complement results in contradiction
 * -  A ⊙ B is reduced to (A ∨ ¬B) ∧ (¬A ∨ B) or
 *    (A ∧ B) ∨ (¬A ∧ ¬B) in negation normal form
 * 
 * @param   xs  `NULL`-terminated list of sentences that should
 *              be joined by the connective XNOR; this can be any
 *              number of arguments; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_NXOR
 * @seealso  libnormalform_nxor_checked
 * @seealso  libnormalform_nxorl_checked
 * @seealso  libnormalform_vxnor_checked
 * @seealso  libnormalform_xnorl
 * @seealso  libnormalform_vxnor
 * @seealso  libnormalform_xnor2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_xnor)(LIBNORMALFORM_SENTENCE **xs);


/**
 * NIF: Converse nonimplication
 * 
 * Also known as NOT..BUT, Converse abjunction
 * 
 * Creates a chain where any condition must be less
 * satisfied than the condition left to it (xs[0] > xs[1])
 * 
 * 0 ↚ 0 = 0
 * 0 ↚ 1 = 1
 * 1 ↚ 0 = 0
 * 1 ↚ 1 = 0
 * 
 * Properties:
 * -  Vacuous falsity
 * -  Identity singleton
 * -  Non-commutative
 * -  Left-associative: A ↚ B ↚ C = (A ↚ B) ↚ C ≠ A ↚ (B ↚ C)
 * -  Complemented by right ⊤
 * -  Dominated by right ⊥
 * -  Left truth results in contradiction
 * -  ⊥ as left identity
 * -  Contrapositivity: A ↚ B = ¬B ↚ ¬A
 * -  Antireflexive: A ↚ A = ⊥
 * -  Left-distributive: A ↚ (B ↚ C) = (A ↚ B) ↚ (A ↚ C)
 * -  Distributive over right AND
 * -  Distributive over right OR
 * -  Distributing over left AND changes AND to OR
 * -  Distributing over left OR changes OR to AND
 * -  A ↚ B is reduced to ¬A ∧ B in negation normal form
 * 
 * Commonly written "↚", "⇍", "!<-", "<-~", "</-", "!<=", "<=~", "</=", "⊄", "⭉" (or "←̃"), or ">"
 * 
 * @param   xs  `NULL`-terminated list of sentences that should be
 *              joined by the connective NIF; this can be any number
 *              of arguments, even none; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_NIF
 * @seealso  libnormalform_nif_checked
 * @seealso  libnormalform_nifl_checked
 * @seealso  libnormalform_vnif_checked
 * @seealso  libnormalform_nifl
 * @seealso  libnormalform_vnif
 * @seealso  libnormalform_nif2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_nif)(LIBNORMALFORM_SENTENCE **xs);


/**
 * NIMPLY: Material nonimplication
 * 
 * Also known as NIMPLIES, BUT NOT or Material abjunction
 * 
 * Creates a chain where any condition must be more
 * satisfied than the condition left to it (xs[0] < xs[1])
 * 
 * 0 ↛ 0 = 0
 * 0 ↛ 1 = 0
 * 1 ↛ 0 = 1
 * 1 ↛ 1 = 0
 * 
 * Properties:
 * -  Identity singleton
 * -  Non-commutative
 * -  Right-associative: A ↛ B ↛ C = A ↛ (B ↛ C) ≠ (A ↛ B) → C
 * -  Complemented by left ⊤
 * -  Dominated by left ⊥
 * -  Right truth results in contradiction
 * -  ⊥ as right identity
 * -  Contrapositivity: A ↛ B = ¬B ↛ ¬A
 * -  Antireflexive: A ↛ A = ⊥
 * -  Right-distributive: (A ↛ B) ↛ C = (A ↛ C) ↛ (B → C)
 * -  Distributive over left AND
 * -  Distributive over left OR
 * -  Distributing over right AND changes AND to OR
 * -  Distributing over right OR changes OR to AND
 * -  A ↛ B is reduced to A ∧ ¬B in negation normal form
 * 
 * Commonly written "↛", "⇏", "!->", "->~", "-/>", "!=>", "=>~", "=/>", "⊅", "⥲" (or "→̃"), or "<"
 * 
 * @param   xs  `NULL`-terminated list of sentences that should be
 *              joined by the connective NIMPLY; this can be any positive
 *              number of arguments; ownership of object in the array
 *              (but not the array itself) is transfered to this function
 * @return      The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * @throws  EDOM    `xs` contains no term (but only `NULL`)
 * 
 * Ownership is always transfered, even on failure
 * 
 * @seealso  LIBNORMALFORM_NIMPLY
 * @seealso  libnormalform_nimply_checked
 * @seealso  libnormalform_nimplyl_checked
 * @seealso  libnormalform_vnimply_checked
 * @seealso  libnormalform_nimplyl
 * @seealso  libnormalform_vnimply
 * @seealso  libnormalform_nimply2
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
LIBNORMALFORM_SENTENCE *(libnormalform_nimply)(LIBNORMALFORM_SENTENCE **xs);





/**
 * THERE EXISTS: Existential quantification (unmapped)
 * 
 * The predicate must be met for at least one element;
 * if no element exists, the sentence is false
 * 
 * Commonly written "∃" ("∃x∈d.k", "∃x∈d k(x)", or "∃ x∈d : k(x)")
 * 
 * The predicate is tested on `.key` in each element
 * in the domain, and `.value` is unused
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   k  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `k` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `k` to
 * be `NULL`)
 * 
 * @seealso  libnormalform_any
 * @seealso  libnormalform_existentially
 * @seealso  libnormalform_nexists
 * @seealso  libnormalform_unique
 * @seealso  libnormalform_nonempty
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_exists)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *k)
{ return libnormalform_any(d, k, libnormalform_true()); }


/**
 * THERE EXISTS NO: Negated existential quantification (unmapped)
 * 
 * The predicate must be unmet for every element;
 * if no element exists, the sentence is true
 * 
 * Commonly written "∄" ("∄x∈d.k", "∄x∈d k(x)", or "∄ x∈d : k(x)"),
 * "~∃", "¬∃", or as THERE EXISTS with overline
 * 
 * The predicate is tested on `.key` in each element
 * in the domain, and `.value` is unused
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   k  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `k` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `k` to
 * be `NULL`)
 * 
 * @seealso  libnormalform_all
 * @seealso  libnormalform_exists
 * @seealso  libnormalform_empty
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nexists)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *k)
{ return libnormalform_all(d, k, libnormalform_false()); }


/**
 * THERE EXISTS ONE: Unique existential quantification (unmapped)
 * 
 * The predicate must be met for exactly one element;
 * if no element exists, the sentence is false
 * 
 * Commonly written "∃!" ("∃!x∈d.k", "∃!x∈d k(x)", or "∃! x∈d : k(x)")
 * 
 * The predicate is tested on `.key` in each element
 * in the domain, and `.value` is unused
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   k  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `k` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `k` to
 * be `NULL`)
 * 
 * @seealso  libnormalform_one
 * @seealso  libnormalform_uniquely
 * @seealso  libnormalform_exists
 * @seealso  libnormalform_singleton
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_unique)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *k)
{ return libnormalform_one(d, k, libnormalform_true()); }





/**
 * SOMEWHERE: Existential quantification (premapped)
 * 
 * The predicate must be met for at least one element;
 * if no element exists, the sentence is false
 * 
 * Commonly written "∃" ("∃x∈d.v", "∃x∈d v(x)", or "v(x) ∃ x∈d")
 * 
 * The predicate is tested on `.value` in each element
 * in the domain, and `.key` is unused
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   v  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `v` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `v` to
 * be `NULL`)
 * 
 * @seealso  libnormalform_any
 * @seealso  libnormalform_exists
 * @seealso  libnormalform_universally
 * @seealso  libnormalform_uniquely
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_existentially)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *v)
{ return libnormalform_any(d, libnormalform_true(), v); }


/**
 * EVERYWHERE: Universal quantification (premapped)
 * 
 * The predicate must be unmet for every element;
 * if no element exists, the sentence is true
 * 
 * Commonly written "∀" ("∀x∈d.v", "∀x∈d v(x)", or "v(x) ∀ x∈d")
 * 
 * The predicate is tested on `.value` in each element
 * in the domain, and `.key` is unused
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   v  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `v` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `v` to
 * be `NULL`)
 * 
 * @seealso  libnormalform_all
 * @seealso  libnormalform_existentially
 * @seealso  libnormalform_uniquely
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_universally)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *v)
{ return libnormalform_all(d, libnormalform_true(), v); }


/**
 * ONEWHERE: Unique existential quantification (premapped)
 * 
 * The predicate must be met for exactly one element;
 * if no element exists, the sentence is false
 * 
 * Commonly written "∃!" ("∃!x∈d.v", "∃!x∈d v(x)", or "v(x) ∃! x∈d")
 * 
 * The predicate is tested on `.value` in each element
 * in the domain, and `.key` is unused
 * 
 * @param   d  The domain of interest; ownership is retained by the caller
 * @param   v  The predicate; ownership is transfered to this function
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * Ownership is always transfered, even on failure
 * 
 * If `v` is `NULL`, this function will return `NULL`
 * (indicating failure) without modified `errno` (expecting
 * it to be set by a function that failed, causing `v` to
 * be `NULL`)
 * 
 * @seealso  libnormalform_one
 * @seealso  libnormalform_unique
 * @seealso  libnormalform_existentially
 * @seealso  libnormalform_universially
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_uniquely)(struct libnormalform_map *d, LIBNORMALFORM_SENTENCE *v)
{ return libnormalform_one(d, libnormalform_true(), v); }





/**
 * Create a sentence that checks whether a set is empty
 *
 * The sentence technically classifies as a qualification
 * 
 * Commonly written "X=∅" or "|X|=0"
 * 
 * @param   d  The set; ownership is retained by the caller
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * @seealso  libnormalform_nonempty
 * @seealso  libnormalform_singleton
 * @seealso  libnormalform_nexists
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_empty)(struct libnormalform_map *d)
{ return libnormalform_all(d, libnormalform_true(), libnormalform_false()); }


/**
 * Create a sentence that checks whether a set is non-empty
 *
 * The sentence technically classifies as a qualification
 * 
 * Commonly written "X≠∅", "X⊃∅", "X⊋∅" "|X|≠0", or "|X|>0"
 * 
 * @param   d  The set; ownership is retained by the caller
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * @seealso  libnormalform_empty
 * @seealso  libnormalform_singleton
 * @seealso  libnormalform_exists
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nonempty)(struct libnormalform_map *d)
{ return libnormalform_any(d, libnormalform_true(), libnormalform_true()); }


/**
 * Create a sentence that checks whether a set is a singleton
 * (contains exactly one element)
 *
 * The sentence technically classifies as a qualification
 * 
 * Commonly written "|X|=1", "∃! x : X={x}", "X={x} ∃! x", or just "X={x}"
 * 
 * @param   d  The set; ownership is retained by the caller
 * @return     The constructed sentence, `NULL` on failure
 * 
 * @throws  ENOMEM  Insufficient memory available to create the sentence
 * 
 * @seealso  libnormalform_empty
 * @seealso  libnormalform_nonempty
 * @seealso  libnormalform_unique
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_singleton)(struct libnormalform_map *d)
{ return libnormalform_one(d, libnormalform_true(), libnormalform_true()); }





/**
 * Variant of `libnormalform_and` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_and`
 * @return      See `libnormalform_and`
 * @throws      See `libnormalform_and`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_and_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(and) }


/**
 * Variant of `libnormalform_or` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_or`
 * @return      See `libnormalform_or`
 * @throws      See `libnormalform_or`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_or_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(or) }


/**
 * Variant of `libnormalform_xor` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_xor`
 * @return      See `libnormalform_xor`
 * @throws      See `libnormalform_xor`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_xor_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(xor) }


/**
 * Variant of `libnormalform_if` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_if`
 * @return      See `libnormalform_if`
 * @throws      See `libnormalform_if`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_if_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(if) }


/**
 * Variant of `libnormalform_imply` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_imply`
 * @return      See `libnormalform_imply`
 * @throws      See `libnormalform_imply`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_imply_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(imply) }


/**
 * Variant of `libnormalform_nand` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_nand`
 * @return      See `libnormalform_nand`
 * @throws      See `libnormalform_nand`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nand_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(nand) }


/**
 * Variant of `libnormalform_nor` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_nor`
 * @return      See `libnormalform_nor`
 * @throws      See `libnormalform_nor`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nor_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(nor) }


/**
 * Variant of `libnormalform_xnor` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_xnor`
 * @return      See `libnormalform_xnor`
 * @throws      See `libnormalform_xnor`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_xnor_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(xnor) }


/**
 * Variant of `libnormalform_nif` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_nif`
 * @return      See `libnormalform_nif`
 * @throws      See `libnormalform_nif`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nif_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(nif) }


/**
 * Variant of `libnormalform_nimply` that checks
 * for unexpected `NULL` input
 *
 * @param   n   The number of expected non-`NULL` terms
 * @param   xs  See `libnormalform_nimply`
 * @return      See `libnormalform_nimply`
 * @throws      See `libnormalform_nimply`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NONNULL_INPUT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nimply_checked)(size_t n, LIBNORMALFORM_SENTENCE **xs)
{ LIBNORMALFORM_CHECKED__(nimply) }





/**
 * Variant of `libnormalform_andl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_andl`
 * @throws           See `libnormalform_andl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vand)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(and) }


/**
 * Variant of `libnormalform_orl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_orl`
 * @throws           See `libnormalform_orl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vor)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(or) }


/**
 * Variant of `libnormalform_xorl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_xorl`
 * @throws           See `libnormalform_xorl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vxor)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(xor) }


/**
 * Variant of `libnormalform_ifl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_ifl`
 * @throws           See `libnormalform_ifl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vif)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(if) }


/**
 * Variant of `libnormalform_implyl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_implyl`
 * @throws           See `libnormalform_implyl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vimply)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(imply) }


/**
 * Variant of `libnormalform_nandl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_nandl`
 * @throws           See `libnormalform_nandl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vnand)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(nand) }


/**
 * Variant of `libnormalform_norl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_norl`
 * @throws           See `libnormalform_norl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vnor)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(nor) }


/**
 * Variant of `libnormalform_xnorl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_xnorl`
 * @throws           See `libnormalform_xnorl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vxnor)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(xnor) }


/**
 * Variant of `libnormalform_nifl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_nifl`
 * @throws           See `libnormalform_nifl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vnif)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(nif) }


/**
 * Variant of `libnormalform_nimplyl` that uses `va_list`
 * instead of variadic arguments
 * 
 * @param   a, args  `NULL`-terminated list of terms; the function
 *                   will take ownership of each input reference,
 *                   so the caller shall not attempt to deallocate
 *                   or use them again.
 * @return           See `libnormalform_nimplyl`
 * @throws           See `libnormalform_nimplyl`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vnimply)(LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST__(nimply) }





/**
 * Variant of `libnormalform_and` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_and`
 * @throws          See `libnormalform_and`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_andl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(and) }


/**
 * Variant of `libnormalform_or` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_or`
 * @throws          See `libnormalform_or`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_orl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(or) }


/**
 * Variant of `libnormalform_xor` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_xor`
 * @throws          See `libnormalform_xor`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_xorl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(xor) }


/**
 * Variant of `libnormalform_if` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_if`
 * @throws          See `libnormalform_if`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_ifl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(if) }


/**
 * Variant of `libnormalform_imply` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_imply`
 * @throws          See `libnormalform_imply`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_implyl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(imply) }


/**
 * Variant of `libnormalform_nand` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_nand`
 * @throws          See `libnormalform_nand`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nandl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(nand) }


/**
 * Variant of `libnormalform_nor` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_nor`
 * @throws          See `libnormalform_nor`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_norl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(nor) }


/**
 * Variant of `libnormalform_xnor` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_xnor`
 * @throws          See `libnormalform_xnor`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_xnorl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(xnor) }


/**
 * Variant of `libnormalform_nif` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_nif`
 * @throws          See `libnormalform_nif`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nifl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(nif) }


/**
 * Variant of `libnormalform_nimply` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_nimply`
 * @throws          See `libnormalform_nimply`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nimplyl)(LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS__(nimply) }





/**
 * Variant of `libnormalform_vand` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vand`
 * @return           See `libnormalform_vand`
 * @throws           See `libnormalform_vand`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vand_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(and) }


/**
 * Variant of `libnormalform_vor` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vor`
 * @return           See `libnormalform_vor`
 * @throws           See `libnormalform_vor`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vor_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(or) }


/**
 * Variant of `libnormalform_vxor` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vxor`
 * @return           See `libnormalform_vxor`
 * @throws           See `libnormalform_vxor`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vxor_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(xor) }


/**
 * Variant of `libnormalform_vif` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vif`
 * @return           See `libnormalform_vif`
 * @throws           See `libnormalform_vif`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vif_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(if) }


/**
 * Variant of `libnormalform_vimply` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vimply`
 * @return           See `libnormalform_vimply`
 * @throws           See `libnormalform_vimply`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vimply_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(imply) }


/**
 * Variant of `libnormalform_vnand` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vnand`
 * @return           See `libnormalform_vnand`
 * @throws           See `libnormalform_vnand`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vnand_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(nand) }


/**
 * Variant of `libnormalform_vnor` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vnor`
 * @return           See `libnormalform_vnor`
 * @throws           See `libnormalform_vnor`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vnor_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(nor) }


/**
 * Variant of `libnormalform_vxnor` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vxnor`
 * @return           See `libnormalform_vxnor`
 * @throws           See `libnormalform_vxnor`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vxnor_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(xnor) }


/**
 * Variant of `libnormalform_vnif` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vnif`
 * @return           See `libnormalform_vnif`
 * @throws           See `libnormalform_vnif`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vnif_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(nif) }


/**
 * Variant of `libnormalform_vnimply` that checks
 * for unexpected `NULL` input
 *
 * @param   n        The number of expected non-`NULL` terms
 * @param   a, args  See `libnormalform_vnimply`
 * @return           See `libnormalform_vnimply`
 * @throws           See `libnormalform_vnimply`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_vnimply_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, va_list args)
{ LIBNORMALFORM_VALIST_CHECKED__(nimply) }





/**
 * Variant of `libnormalform_andl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_andl`
 * @return          See `libnormalform_andl`
 * @throws          See `libnormalform_andl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_andl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(and) }


/**
 * Variant of `libnormalform_orl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_orl`
 * @return          See `libnormalform_orl`
 * @throws          See `libnormalform_orl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_orl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(or) }


/**
 * Variant of `libnormalform_xorl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_xorl`
 * @return          See `libnormalform_xorl`
 * @throws          See `libnormalform_xorl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_xorl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(xor) }


/**
 * Variant of `libnormalform_ifl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_ifl`
 * @return          See `libnormalform_ifl`
 * @throws          See `libnormalform_ifl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_ifl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(if) }


/**
 * Variant of `libnormalform_implyl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_implyl`
 * @return          See `libnormalform_implyl`
 * @throws          See `libnormalform_implyl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_implyl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(imply) }


/**
 * Variant of `libnormalform_nandl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_nandl`
 * @return          See `libnormalform_nandl`
 * @throws          See `libnormalform_nandl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nandl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(nand) }


/**
 * Variant of `libnormalform_norl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_norl`
 * @return          See `libnormalform_norl`
 * @throws          See `libnormalform_norl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_norl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(nor) }


/**
 * Variant of `libnormalform_xnorl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_xnorl`
 * @return          See `libnormalform_xnorl`
 * @throws          See `libnormalform_xnorl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_xnorl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(xnor) }


/**
 * Variant of `libnormalform_nifl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_nifl`
 * @return          See `libnormalform_nifl`
 * @throws          See `libnormalform_nifl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nifl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(nif) }


/**
 * Variant of `libnormalform_nimplyl` that checks
 * for unexpected `NULL` input
 *
 * @param   n       The number of expected non-`NULL` terms
 * @param   a, ...  See `libnormalform_nimplyl`
 * @return          See `libnormalform_nimplyl`
 * @throws          See `libnormalform_nimplyl`
 * 
 * If the function finds any unexpected `NULL` terms,
 * it will call `libnormalform_free` on all non-`NULL` terms
 * and return `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__ LIBNORMALFORM_NULL_LAST__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nimplyl_checked)(size_t n, LIBNORMALFORM_SENTENCE *a, ...)
{ LIBNORMALFORM_ELLIPSIS_CHECKED__(nimply) }





/**
 * Variant of `libnormalform_and` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_and`
 * @throws     See `libnormalform_and`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
LIBNORMALFORM_SENTENCE *(libnormalform_and2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r);


/**
 * Variant of `libnormalform_or` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_or`
 * @throws     See `libnormalform_or`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
LIBNORMALFORM_SENTENCE *(libnormalform_or2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r);


/**
 * Variant of `libnormalform_xor` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_xor`
 * @throws     See `libnormalform_xor`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
LIBNORMALFORM_SENTENCE *(libnormalform_xor2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r);


/**
 * Variant of `libnormalform_if` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_if`
 * @throws     See `libnormalform_if`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_if2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r)
{ LIBNORMALFORM_TWO__(if) }


/**
 * Variant of `libnormalform_imply` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_imply`
 * @throws     See `libnormalform_imply`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_imply2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r)
{ LIBNORMALFORM_TWO__(imply) }


/**
 * Variant of `libnormalform_nand` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_nand`
 * @throws     See `libnormalform_nand`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nand2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r)
{ LIBNORMALFORM_TWO__(nand) }


/**
 * Variant of `libnormalform_nor` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_nor`
 * @throws     See `libnormalform_nor`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nor2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r)
{ LIBNORMALFORM_TWO__(nor) }


/**
 * Variant of `libnormalform_xnor` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_xnor`
 * @throws     See `libnormalform_xnor`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_xnor2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r)
{ LIBNORMALFORM_TWO__(xnor) }


/**
 * Variant of `libnormalform_nif` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_nif`
 * @throws     See `libnormalform_nif`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nif2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r)
{ LIBNORMALFORM_TWO__(nif) }


/**
 * Variant of `libnormalform_nimply` that takes exactly two terms
 *
 * @param   l  The left-hand term
 * @param   r  The right-hand term
 * @return     See `libnormalform_nimply`
 * @throws     See `libnormalform_nimply`
 * 
 * If `l` or `r` is `NULL`, the function will call
 * `libnormalform_free` on both arguments and return
 * `NULL` (indicating failure) without setting
 * `errno` (expected to already be set in indicate the
 * error that caused one of the terms to be `NULL`)
 */
LIBNORMALFORM_USE_RESULT__
inline LIBNORMALFORM_SENTENCE *
(libnormalform_nimply2)(LIBNORMALFORM_SENTENCE *l, LIBNORMALFORM_SENTENCE *r)
{ LIBNORMALFORM_TWO__(nimply) }





/* These are macro versions of function with the same name */

/**
 * Variant of `libnormalform_and` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_and`
 * @throws          See `libnormalform_and`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_andl(...) (libnormalform_and((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_or` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_or`
 * @throws          See `libnormalform_or`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_orl(...) (libnormalform_or((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_xor` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_xor`
 * @throws          See `libnormalform_xor`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_xorl(...) (libnormalform_xor((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_if` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_if`
 * @throws          See `libnormalform_if`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_ifl(...) (libnormalform_if((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_imply` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_imply`
 * @throws          See `libnormalform_imply`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_implyl(...) (libnormalform_imply((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_nand` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_nand`
 * @throws          See `libnormalform_nand`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_nandl(...) (libnormalform_nand((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_nor` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_nor`
 * @throws          See `libnormalform_nor`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_norl(...) (libnormalform_nor((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_xnor` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_xnor`
 * @throws          See `libnormalform_xnor`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_xnorl(...) (libnormalform_xnor((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_nif` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_nif`
 * @throws          See `libnormalform_nif`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_nifl(...) (libnormalform_nif((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))


/**
 * Variant of `libnormalform_nimply` that uses variadic arguments
 * 
 * @param   a, ...  `NULL`-terminated list of terms; the function
 *                  will take ownership of each input reference,
 *                  so the caller shall not attempt to deallocate
 *                  or use them again.
 * @return          See `libnormalform_nimply`
 * @throws          See `libnormalform_nimply`
 * 
 * Be careful not in inputing any `NULL` apart from
 * the list terminator as the function will not be
 * able to see them.
 */
#define libnormalform_nimplyl(...) (libnormalform_nimply((LIBNORMALFORM_SENTENCE *[]){__VA_ARGS__}))





/**
 * Macro variant of `libnormalform_andl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_andl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_AND(...) LIBNORMALFORM_MACRO__(and, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_orl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_orl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_OR(...) LIBNORMALFORM_MACRO__(or, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_xorl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_xorl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_XOR(...) LIBNORMALFORM_MACRO__(xor, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_ifl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_ifl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_IF(...) LIBNORMALFORM_MACRO__(if, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_implyl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_implyl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_IMPLY(...) LIBNORMALFORM_MACRO__(imply, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_nandl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_nandl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_NAND(...) LIBNORMALFORM_MACRO__(nand, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_norl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_norl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_NOR(...) LIBNORMALFORM_MACRO__(nor, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_xnorl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_xnorl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_XNOR(...) LIBNORMALFORM_MACRO__(xnor, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_nifl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_nifl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_NIF(...) LIBNORMALFORM_MACRO__(nif, __VA_ARGS__)


/**
 * Macro variant of `libnormalform_nimplyl_checked`, that
 * will add the `NULL` to the end of the list and, before
 * the list, the number of terms in the list
 * 
 * @param   ...  List of terms, _without_ `NULL`-terinator
 * @return       See `libnormalform_nimplyl_checked`
 *
 * Either any argument is `NULL`, `libnormalform_free` on
 * will be called for all non-`NULL` terms, the `NULL`
 * with be return (indicating failure) without `errno`
 * being modified (it is expected to already be set in
 * indicate the error that caused one of the terms to be
 * `NULL`)
 */
#define LIBNORMALFORM_NIMPLY(...) LIBNORMALFORM_MACRO__(nimply, __VA_ARGS__)





#undef LIBNORMALFORM_CHECKED__
#undef LIBNORMALFORM_VALIST__
#undef LIBNORMALFORM_ELLIPSIS__
#undef LIBNORMALFORM_VALIST_CHECKED__
#undef LIBNORMALFORM_ELLIPSIS_CHECKED__
#undef LIBNORMALFORM_TWO__

#undef LIBNORMALFORM_USE_RESULT__
#undef LIBNORMALFORM_FREE_WITH__
#undef LIBNORMALFORM_USE_FREE__
#undef LIBNORMALFORM_NONNULL_INPUT__
#undef LIBNORMALFORM_ONE_NONNULL_INPUT__
#undef LIBNORMALFORM_NULL_LAST__


#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif

#endif