summaryrefslogtreecommitdiff
path: root/Source/Core/CommandLineOptions.cs
blob: 2fb29d7a30e7e3da2bd52492f493d74a82fb5a13 (plain)
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
//-----------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation.  All Rights Reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Diagnostics;
using System.Diagnostics.Contracts;

namespace Microsoft.Boogie {
  public class CommandLineOptions {
    public static string/*!*/ VersionNumber {
      get {
        Contract.Ensures(Contract.Result<string>() != null);
        return cce.NonNull(cce.NonNull(System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location)).FileVersion);
      }
    }
    public const string ToolNameBoogie = "Boogie program verifier";
    public const string ToolNameSpecSharp = "Spec# program verifier";
    public const string ToolNameDafny = "Dafny program verifier";
    public static string/*!*/ VersionSuffix {
      get {
        Contract.Ensures(Contract.Result<string>() != null);
        return " version " + VersionNumber + ", Copyright (c) 2003-2010, Microsoft.";
      }
    }
    public string/*!*/ InputFileExtension {
      set {
        Contract.Requires(value != null);
        //modifies _toolname, _version;
        switch (value) {
          case ".bpl":
            _toolname = ToolNameBoogie;
            break;
          case ".dfy":
            _toolname = ToolNameDafny;
            break;
          default:
            _toolname = ToolNameSpecSharp;
            break;
        }
        _version = _toolname + VersionSuffix;
      }
    }
    string/*!*/ _toolname = ToolNameBoogie;
    string/*!*/ _version = ToolNameBoogie + VersionSuffix;
    [ContractInvariantMethod]
    void ObjectInvariant() {
      Contract.Invariant(_toolname != null);
      Contract.Invariant(_version != null);
      Contract.Invariant(Environment != null);
      Contract.Invariant(FileName != null);
      Contract.Invariant(cce.NonNullElements(Files));
      Contract.Invariant(cce.NonNullElements(ContractAssemblies));
      Contract.Invariant(FileTimestamp != null);
    }

    public string/*!*/ ToolName {
      get {
        Contract.Ensures(Contract.Result<string>() != null);
        return _toolname;
      }
    }
    public string/*!*/ Version {
      get {
        Contract.Ensures(Contract.Result<string>() != null);
        return _version;
      }
    }

    public static readonly CommandLineOptions/*!*/ Clo = new CommandLineOptions();  // singleton to access all global data

    public string/*!*/ Environment = "";
    public string/*!*/ FileName = "unknown";

    public const long Megabyte = 1048576;

    // Flags and arguments

    public bool RunningBoogieFromCommandLine = false;  // "false" means running Boogie from the plug-in
    public bool RunningBoogieOnSsc = true; // "true" means running Boogie on ssc input while false means running it on bpl input

    public bool AttrHelpRequested = false;

    [Peer]
    public List<string/*!*/>/*!*/ Files = new List<string/*!*/>();
    public List<string/*!*/>/*!*/ ContractAssemblies = new List<string/*!*/>();

    public string/*!*/ FileTimestamp = cce.NonNull(DateTime.Now.ToString("o")).Replace(':', '.');
    public void ExpandFilename(ref string pattern) {
      if (pattern != null) {
        pattern = pattern.Replace("@PREFIX@", LogPrefix).Replace("@TIME@", FileTimestamp);
        string fn = Files.Count == 0 ? "" : Files[Files.Count - 1];
        fn = fn.Replace('/', '-').Replace('\\', '-');
        pattern = pattern.Replace("@FILE@", fn);
      }
    }

    [ContractInvariantMethod]
    void ObjectInvariant2() {
      Contract.Invariant(LogPrefix != null);
      Contract.Invariant(0 <= PrintUnstructured && PrintUnstructured < 3);  // 0 = print only structured,  1 = both structured and unstructured,  2 = only unstructured

    }

    public string PrintFile = null;
    public int PrintUnstructured = 0;

    public bool PrintDesugarings = false;
    public string SimplifyLogFilePath = null;
    public string/*!*/ LogPrefix = "";
    public bool PrintInstrumented = false;
    public bool InstrumentWithAsserts = false;
    public enum InstrumentationPlaces {
      LoopHeaders,
      Everywhere
    }
    public InstrumentationPlaces InstrumentInfer = InstrumentationPlaces.LoopHeaders;
    public bool PrintWithUniqueASTIds = false;
    private string XmlSinkFilename = null;
    [Peer]
    public XmlSink XmlSink = null;
    public bool Wait = false;
    public bool Trace = false;
    public bool TraceTimes = false;
    public bool NoResolve = false;
    public bool NoTypecheck = false;
    public bool OverlookBoogieTypeErrors = false;
    public bool Verify = true;
    public bool TraceVerify = false;
    public int /*(0:3)*/ ErrorTrace = 1;
    public bool IntraproceduralInfer = true;
    public bool ContractInfer = false;
    public bool UseUncheckedContracts = false;
    public bool SimplifyLogFileAppend = false;
    public bool SoundnessSmokeTest = false;

    private bool noConsistencyChecks = false;
    public bool NoConsistencyChecks {
      get {
        return !Verify ? true : noConsistencyChecks;
      }
      set
        //modifies noConsistencyChecks;
        {
        noConsistencyChecks = value;
      }
    }

    public string DafnyPrelude = null;
    public string DafnyPrintFile = null;
    public bool Compile = true;

    public enum ProverWarnings {
      None,
      Stdout,
      Stderr
    }
    public ProverWarnings PrintProverWarnings = ProverWarnings.None;
    public int ProverShutdownLimit = 0;

    public enum SubsumptionOption {
      Never,
      NotForQuantifiers,
      Always
    }
    public SubsumptionOption UseSubsumption = SubsumptionOption.Always;

    public bool AlwaysAssumeFreeLoopInvariants = false;

    public enum ShowEnvironment {
      Never,
      DuringPrint,
      Always
    }
    public ShowEnvironment ShowEnv = ShowEnvironment.DuringPrint;
    public bool DontShowLogo = false;
    [ContractInvariantMethod]
    void ObjectInvariant3() {
      Contract.Invariant(0 <= CheckingLevel && CheckingLevel < 3);
      Contract.Invariant(0 <= OrderStrength && OrderStrength < 2);
      Contract.Invariant(0 <= SummationAxiomStrength && SummationAxiomStrength < 2);
      Contract.Invariant(0 <= InductiveMinMax && InductiveMinMax < 6);
      Contract.Invariant(0 <= FCOStrength && FCOStrength < 6);
      Contract.Invariant(-1 <= LoopFrameConditions && LoopFrameConditions < 3);
      Contract.Invariant(0 <= ModifiesDefault && ModifiesDefault < 7);
      Contract.Invariant((0 <= PrintErrorModel && PrintErrorModel <= 2) || PrintErrorModel == 4);
      Contract.Invariant(0 <= EnhancedErrorMessages && EnhancedErrorMessages < 2);
      Contract.Invariant(0 <= StepsBeforeWidening && StepsBeforeWidening <= 9);
      Contract.Invariant(-1 <= BracketIdsInVC && BracketIdsInVC <= 1);
      Contract.Invariant(cce.NonNullElements(ProverOptions));






    }

    public int CheckingLevel = 2;
    public enum Methodology {
      Boogie,
      VisibleState
    }
    public Methodology MethodologySelection = Methodology.Boogie;
    public int OrderStrength = 0;
    public bool UseArithDistributionAxioms = false;
    public int SummationAxiomStrength = 1;
    public int InductiveMinMax = 0;
    public int FCOStrength = 5;
    public int LoopUnrollCount = -1;  // -1 means don't unroll loops
    public int LoopFrameConditions = -1;  // -1 means not specified -- this will be replaced by the "implications" section below
    public int ModifiesDefault = 5;
    public bool LocalModifiesChecks = true;
    public bool NoVerifyByDefault = false;
    public enum OwnershipModelOption {
      Standard,
      Experimental,
      Trivial
    }
    public OwnershipModelOption OwnershipModelEncoding = OwnershipModelOption.Standard;
    public int PrintErrorModel = 0;
    public string PrintErrorModelFile = null;
    public string/*?*/ ModelViewFile = null;
    public int EnhancedErrorMessages = 0;
    public bool ForceBplErrors = false; // if true, boogie error is shown even if "msg" attribute is present
    public enum BvHandling {
      None,
      Z3Native,
      ToInt
    }
    public BvHandling Bitvectors = BvHandling.Z3Native;
    public bool UseArrayTheory = false;
    public bool MonomorphicArrays {
      get {
        return UseArrayTheory || TypeEncodingMethod == TypeEncoding.Monomorphic;
      }
    }
    public bool ExpandLambdas = true; // not useful from command line, only to be set to false programatically
    public bool DoModSetAnalysis = false;
    public bool UseAbstractInterpretation = true;          // true iff the user want to use abstract interpretation
    public int  /*0..9*/StepsBeforeWidening = 0;           // The number of steps that must be done before applying a widen operator


    public enum VCVariety {
      Structured,
      Block,
      Local,
      BlockNested,
      BlockReach,
      BlockNestedReach,
      Dag,
      Doomed,
      Unspecified
    }
    public VCVariety vcVariety = VCVariety.Unspecified;  // will not be Unspecified after command line has been parsed
    public bool useDoomDebug = false; // Will use doomed analysis to search for errors if set

    public bool RemoveEmptyBlocks = true;
    public bool CoalesceBlocks = true;

    [Rep]
    public ProverFactory TheProverFactory;
    public string ProverName;
    [Peer]
    public List<string/*!*/>/*!*/ ProverOptions = new List<string/*!*/>();

    public int BracketIdsInVC = -1;  // -1 - not specified, 0 - no, 1 - yes
    public bool CausalImplies = false;

    public int SimplifyProverMatchDepth = -1;  // -1 means not specified
    public int ProverKillTime = -1;  // -1 means not specified
    public int SmokeTimeout = 10; // default to 10s
    public int ProverCCLimit = 5;
    public bool z3AtFlag = true;
    public bool RestartProverPerVC = false;

    public double VcsMaxCost = 1.0;
    public double VcsPathJoinMult = 0.8;
    public double VcsPathCostMult = 1.0;
    public double VcsAssumeMult = 0.01;
    public double VcsPathSplitMult = 0.5; // 0.5-always, 2-rarely do path splitting
    public int VcsMaxSplits = 1;
    public int VcsMaxKeepGoingSplits = 1;
    public int VcsFinalAssertTimeout = 30;
    public int VcsKeepGoingTimeout = 1;
    public int VcsCores = 1;
    public bool VcsDumpSplits = false;

    public bool houdiniEnabled = false;
    public bool DebugRefuted = false;

    public XmlSink XmlRefuted {
      get {
        if (DebugRefuted)
          return XmlSink;
        else
          return null;
      }
    }
    [ContractInvariantMethod]
    void ObjectInvariant4() {
      Contract.Invariant(cce.NonNullElements(Z3Options));
      Contract.Invariant(0 <= Z3lets && Z3lets < 4);
    }

    [Peer]
    public List<string/*!*/>/*!*/ Z3Options = new List<string/*!*/>();
    public bool Z3types = false;
    public int Z3lets = 3;  // 0 - none, 1 - only LET TERM, 2 - only LET FORMULA, 3 - (default) any


    // Maximum amount of virtual memory (in bytes) for the prover to use
    //
    // Non-positive number indicates unbounded.
    public long MaxProverMemory = 100 * Megabyte;

    // Minimum number of prover calls before restart
    public int MinNumOfProverCalls = 5;

    public enum PlatformType {
      notSpecified,
      v1,
      v11,
      v2,
      cli1
    }
    public PlatformType TargetPlatform;
    public string TargetPlatformLocation;
    public string StandardLibraryLocation;

    // whether procedure inlining is enabled at call sites.
    public enum Inlining {
      None,
      Assert,
      Assume,
      Spec
    };
    public Inlining ProcedureInlining = Inlining.Assume;
    public bool PrintInlined = false;
    public bool ExtractLoops = false;
    public int LazyInlining = 0;
    public int StratifiedInlining = 0;
    public int StratifiedInliningOption = 0;
    public bool UseUnsatCoreForInlining = false;
    public int RecursionBound = 500;
    public string inferLeastForUnsat = null;
    public string CoverageReporterPath = null;
    public Process coverageReporter = null; // used internally for debugging

    public enum TypeEncoding {
      None,
      Predicates,
      Arguments,
      Monomorphic
    };
    public TypeEncoding TypeEncodingMethod = TypeEncoding.Predicates;

    public bool Monomorphize = false;

    public bool ReflectAdd = false;

    public int LiveVariableAnalysis = 1;

    // Static constructor
    static CommandLineOptions() {
      if (System.Type.GetType("Mono.Runtime") == null) {  // MONO
        TraceListenerCollection/*!*/ dbl = Debug.Listeners;
        Contract.Assert(dbl != null);
        Contract.Assume(cce.IsPeerConsistent(dbl));  // hangs off static field
#if WHIDBEY
        dbl.Add(new ConsoleTraceListener());
#else
        dbl.Add(new DefaultTraceListener());
#endif
      }
    }

    private string methodToLog = null;
    private string methodToBreakOn = null;
    [ContractInvariantMethod]
    void ObjectInvariant5() {
      Contract.Invariant(cce.NonNullElements(procsToCheck, true));
      Contract.Invariant(cce.NonNullElements(methodsToTranslateClass, true));
      Contract.Invariant(cce.NonNullElements(methodsToTranslateClassQualified, true));
      Contract.Invariant(cce.NonNullElements(methodsToTranslateExclude));
      Contract.Invariant(cce.NonNullElements(methodsToTranslateFile, true));
      Contract.Invariant(cce.NonNullElements(methodsToTranslateMethod, true));
      Contract.Invariant(cce.NonNullElements(methodsToTranslateMethodQualified, true));
      Contract.Invariant(cce.NonNullElements(methodsToTranslateSubstring, true));
      Contract.Invariant(Ai != null);
      Contract.Invariant(houdiniFlags != null);
    }

    [Rep]
    private List<string/*!*/> procsToCheck = null;  // null means "no restriction"
    [Rep]
    private List<string/*!*/> methodsToTranslateSubstring = null;  // null means "no restriction"
    [Rep]
    private List<string/*!*/> methodsToTranslateMethod = null;  // null means "no restriction"
    [Rep]
    private List<string/*!*/> methodsToTranslateMethodQualified = null;  // null means "no restriction"
    [Rep]
    private List<string/*!*/> methodsToTranslateClass = null;  // null means "no restriction"
    [Rep]
    private List<string/*!*/> methodsToTranslateClassQualified = null;  // null means "no restriction"
    [Rep]
    private List<string/*!*/> methodsToTranslateFile = null;  // null means "no restriction"
    [Rep]
    private List<string/*!*/>/*!*/ methodsToTranslateExclude = new List<string/*!*/>();

    public class AiFlags {
      public bool Intervals = false;
      public bool Constant = false;
      public bool DynamicType = false;
      public bool Nullness = false;
      public bool Polyhedra = false;
      public bool DebugStatistics = false;

      public bool AnySet {
        get {
          return Intervals
              || Constant
              || DynamicType
              || Nullness
              || Polyhedra;
        }
      }
    }
    public AiFlags/*!*/ Ai = new AiFlags();

    public class HoudiniFlags {
      public bool continueAtError = false;
      public bool incremental = false;
    }

    public HoudiniFlags/*!*/ houdiniFlags = new HoudiniFlags();

    [Verify(false)]
    public CommandLineOptions() {
      // this is just to suppress verification. 
    }


    /// <summary>
    /// Parses the command-line arguments "args" into the global flag variables.  The possible result
    /// values are:
    /// -2: an error occurred and help was requested
    /// -1: no error occurred and help was requested
    ///  1: no error occurred and help was not requested
    ///  2: an error occurred and help was not requested
    /// </summary>
    /// <param name="args">Consumed ("captured" and possibly modified) by the method.</param>
    [Verify(false)]
    public int Parse([Captured] string[]/*!*/ args) {
      Contract.Requires(cce.NonNullElements(args));
      Contract.Ensures(TheProverFactory != null);
      Contract.Ensures(vcVariety != VCVariety.Unspecified);
      Contract.Ensures(-2 <= Contract.Result<int>() && Contract.Result<int>() <= 2 && Contract.Result<int>() != 0);
      // save the command line options for the log files
      Environment += "Command Line Options:";
      foreach (string s in args)
        Environment += " " + s;
      args = cce.NonNull((string[])args.Clone());  // the operations performed may mutate the array, so make a copy
      CommandLineParseState/*!*/ ps = new CommandLineParseState(args);
      Contract.Assert(ps != null);
      int res = 1;  // the result value

      while (ps.i < args.Length) {
        cce.LoopInvariant(cce.IsPeerConsistent(ps));
        cce.LoopInvariant(ps.args == args);
        ps.s = args[ps.i];
        Contract.Assert(ps.s != null);
        ps.s = ps.s.Trim();

        int colonIndex = ps.s.IndexOf(':');
        if (colonIndex >= 0 && (ps.s.StartsWith("-") || ps.s.StartsWith("/"))) {
          ps.hasColonArgument = true;
          args[ps.i] = ps.s.Substring(colonIndex + 1);
          ps.s = ps.s.Substring(0, colonIndex);
        } else {
          cce.BeginExpose(ps);
          {
            ps.i++;
          }
          cce.EndExpose();
          ps.hasColonArgument = false;
        }
        ps.nextIndex = ps.i;


        switch (ps.s) {
          case "-help":
          case "/help":
          case "-?":
          case "/?":
            if (ps.ConfirmArgumentCount(0)) {
              res = -1;  // help requested
            }
            break;

          case "-attrHelp":
          case "/attrHelp":
            if (ps.ConfirmArgumentCount(0)) {
              AttrHelpRequested = true;
            }
            break;

          case "-infer":
          case "/infer":
            if (ps.ConfirmArgumentCount(1)) {
              foreach (char c in cce.NonNull(args[ps.i])) {
                switch (c) {
                  case 'i':
                    Ai.Intervals = true;
                    UseAbstractInterpretation = true;
                    break;
                  case 'c':
                    Ai.Constant = true;
                    UseAbstractInterpretation = true;
                    break;
                  case 'd':
                    Ai.DynamicType = true;
                    UseAbstractInterpretation = true;
                    break;
                  case 'n':
                    Ai.Nullness = true;
                    UseAbstractInterpretation = true;
                    break;
                  case 'p':
                    Ai.Polyhedra = true;
                    UseAbstractInterpretation = true;
                    break;
                  case 's':
                    Ai.DebugStatistics = true;
                    UseAbstractInterpretation = true;
                    break;
                  case '0':
                  case '1':
                  case '2':
                  case '3':
                  case '4':
                  case '5':
                  case '6':
                  case '7':
                  case '8':
                  case '9':
                    StepsBeforeWidening = (int)char.GetNumericValue(c);
                    break;
                  default:
                    ps.Error("Invalid argument '{0}' to option {1}", c.ToString(), ps.s);
                    break;
                }
              }
            }
            break;

          case "-noinfer":
          case "/noinfer":
            if (ps.ConfirmArgumentCount(0)) {
              UseAbstractInterpretation = false;
            }
            break;

          case "-log":
          case "/log":
            if (ps.hasColonArgument) {
              methodToLog = args[ps.i];
              ps.nextIndex = ps.i + 1;
            } else {
              methodToLog = "*";
            }
            break;

          case "-logInfer":
          case "/logInfer":
            Microsoft.AbstractInterpretationFramework.Lattice.LogSwitch = true;
            break;

          case "-break":
          case "/break":
            if (ps.hasColonArgument) {
              methodToBreakOn = args[ps.i];
              ps.nextIndex = ps.i + 1;
            } else {
              System.Diagnostics.Debugger.Break();
            }
            break;

          case "-launch":
          case "/launch":
            System.Diagnostics.Debugger.Launch();
            break;

          case "-proc":
          case "/proc":
            if (procsToCheck == null) {
              procsToCheck = new List<string/*!*/>();
            }
            if (ps.ConfirmArgumentCount(1)) {
              procsToCheck.Add(cce.NonNull(args[ps.i]));
            }
            break;

          case "-translate":
          case "/translate":
            if (methodsToTranslateSubstring == null) {
              methodsToTranslateSubstring = new List<string/*!*/>();
            }
            if (ps.ConfirmArgumentCount(1)) {
              methodsToTranslateSubstring.Add(cce.NonNull(args[ps.i]));
            }
            break;

          case "-trMethod":
          case "/trMethod":
            if (ps.ConfirmArgumentCount(1)) {
              string m = cce.NonNull(args[ps.i]);
              if (0 <= m.IndexOf('.')) {
                if (methodsToTranslateMethodQualified == null) {
                  methodsToTranslateMethodQualified = new List<string/*!*/>();
                }
                methodsToTranslateMethodQualified.Add(m);
              } else {
                if (methodsToTranslateMethod == null) {
                  methodsToTranslateMethod = new List<string/*!*/>();
                }
                methodsToTranslateMethod.Add(m);
              }
            }
            break;

          case "-trClass":
          case "/trClass":
            if (ps.ConfirmArgumentCount(1)) {
              string m = cce.NonNull(args[ps.i]);
              if (0 <= m.IndexOf('.')) {
                if (methodsToTranslateClassQualified == null) {
                  methodsToTranslateClassQualified = new List<string/*!*/>();
                }
                methodsToTranslateClassQualified.Add(m);
              } else {
                if (methodsToTranslateClass == null) {
                  methodsToTranslateClass = new List<string/*!*/>();
                }
                methodsToTranslateClass.Add(m);
              }
            }
            break;

          case "-trFile":
          case "/trFile":
            if (methodsToTranslateFile == null) {
              methodsToTranslateFile = new List<string/*!*/>();
            }
            if (ps.ConfirmArgumentCount(1)) {
              methodsToTranslateFile.Add(cce.NonNull(args[ps.i]));
            }
            break;

          case "-trExclude":
          case "/trExclude":
            if (ps.ConfirmArgumentCount(1)) {
              methodsToTranslateExclude.Add(cce.NonNull(args[ps.i]));
            }
            break;

          case "-xml":
          case "/xml":
            if (ps.ConfirmArgumentCount(1)) {
              XmlSinkFilename = args[ps.i];
            }
            break;

          case "-print":
          case "/print":
            if (ps.ConfirmArgumentCount(1)) {
              PrintFile = args[ps.i];
            }
            break;

          case "-dprelude":
          case "/dprelude":
            if (ps.ConfirmArgumentCount(1))
            {
                DafnyPrelude = args[ps.i];
            }
            break;

          case "-dprint":
          case "/dprint":
            if (ps.ConfirmArgumentCount(1)) {
              DafnyPrintFile = args[ps.i];
            }
            break;

          case "-compile":
          case "/compile": {
              int compile = 0;
              if (ps.GetNumericArgument(ref compile, 2)) {
                Compile = compile == 1;
              }
              break;
            }

          case "-contracts":
          case "/contracts":
          case "-c":
          case "/c":
            if (ps.ConfirmArgumentCount(1)) {
              ContractAssemblies.Add(cce.NonNull(args[ps.i]));
            }
            break;

          case "-proverLog":
          case "/proverLog":
            if (ps.ConfirmArgumentCount(1)) {
              SimplifyLogFilePath = args[ps.i];
            }
            break;

          case "-logPrefix":
          case "/logPrefix":
            if (ps.ConfirmArgumentCount(1)) {
              string s = cce.NonNull(args[ps.i]);
              LogPrefix += s.Replace('/', '-').Replace('\\', '-');
            }
            break;

          case "-proverShutdownLimit":
          case "/proverShutdownLimit":
            ps.GetNumericArgument(ref ProverShutdownLimit);
            break;

          case "-errorTrace":
          case "/errorTrace":
            ps.GetNumericArgument(ref ErrorTrace, 3);
            break;

          case "-level":
          case "/level":
            ps.GetNumericArgument(ref CheckingLevel, 3);
            break;

          case "-methodology":
          case "/methodology":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "b":
                case "Boogie":
                case "boogie":
                  MethodologySelection = Methodology.Boogie;
                  break;
                case "vs":
                case "visible-state":
                  MethodologySelection = Methodology.VisibleState;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;

          case "-proverWarnings":
          case "/proverWarnings": {
              int pw = 0;
              if (ps.GetNumericArgument(ref pw, 3)) {
                switch (pw) {
                  case 0:
                    PrintProverWarnings = ProverWarnings.None;
                    break;
                  case 1:
                    PrintProverWarnings = ProverWarnings.Stdout;
                    break;
                  case 2:
                    PrintProverWarnings = ProverWarnings.Stderr;
                    break;
                  default: {
                      Contract.Assert(false);
                      throw new cce.UnreachableException();
                    } // postcondition of GetNumericArgument guarantees that we don't get here
                }
              }
              break;
            }

          case "-env":
          case "/env": {
              int e = 0;
              if (ps.GetNumericArgument(ref e, 3)) {
                switch (e) {
                  case 0:
                    ShowEnv = ShowEnvironment.Never;
                    break;
                  case 1:
                    ShowEnv = ShowEnvironment.DuringPrint;
                    break;
                  case 2:
                    ShowEnv = ShowEnvironment.Always;
                    break;
                  default: {
                      Contract.Assert(false);
                      throw new cce.UnreachableException();
                    } // postcondition of GetNumericArgument guarantees that we don't get here
                }
              }
              break;
            }

          case "-loopUnroll":
          case "/loopUnroll":
            ps.GetNumericArgument(ref LoopUnrollCount);
            break;

          case "-modifiesOnLoop":
          case "/modifiesOnLoop":
            ps.GetNumericArgument(ref LoopFrameConditions, 3);
            break;

          case "-modifiesDefault":
          case "/modifiesDefault":
            ps.GetNumericArgument(ref ModifiesDefault, 7);
            break;

          case "-localModifiesChecks":
          case "/localModifiesChecks": {
              int localChecks = 0;
              ps.GetNumericArgument(ref localChecks, 2);
              LocalModifiesChecks = (localChecks != 0);
            }
            break;

          case "-orderStrength":
          case "/orderStrength":
            ps.GetNumericArgument(ref OrderStrength, 2);
            break;

          case "-summationStrength":
          case "/summationStrength":
            ps.GetNumericArgument(ref SummationAxiomStrength, 2);
            break;

          case "-inductiveMinMax":
          case "/inductiveMinMax":
            ps.GetNumericArgument(ref InductiveMinMax, 6);
            break;

          case "-fcoStrength":
          case "/fcoStrength":
            ps.GetNumericArgument(ref FCOStrength, 6);
            break;

          case "-ownerModelEncoding":
          case "/ownerModelEncoding":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "s":
                case "standard":
                  OwnershipModelEncoding = OwnershipModelOption.Standard;
                  break;
                case "e":
                case "experimental":
                  OwnershipModelEncoding = OwnershipModelOption.Experimental;
                  break;
                case "t":
                case "trivial":
                  OwnershipModelEncoding = OwnershipModelOption.Trivial;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;

          case "-printModel":
          case "/printModel":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "0":
                  PrintErrorModel = 0;
                  break;
                case "1":
                  PrintErrorModel = 1;
                  break;
                case "2":
                  PrintErrorModel = 2;
                  break;
                case "4":
                  PrintErrorModel = 4;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;


          case "-mv":
          case "/mv":
            if (ps.ConfirmArgumentCount(1)) {
              ModelViewFile = args[ps.i];
            }
            break;

          case "-printModelToFile":
          case "/printModelToFile":
            if (ps.ConfirmArgumentCount(1)) {
              PrintErrorModelFile = args[ps.i];
            }
            break;


          case "-enhancedErrorMessages":
          case "/enhancedErrorMessages":
            ps.GetNumericArgument(ref EnhancedErrorMessages, 2);
            break;

          case "-forceBplErrors":
          case "/forceBplErrors":
            ForceBplErrors = true;
            break;

          case "-bv":
          case "/bv":
            if (ps.ConfirmArgumentCount(1)) {
              if (TheProverFactory == null) {
                TheProverFactory = ProverFactory.Load("Z3");
                ProverName = "Z3".ToUpper();
              }

              switch (args[ps.i]) {
                case "n":
                  Bitvectors = BvHandling.None;
                  break;
                case "z":
                  Bitvectors = BvHandling.Z3Native;
                  break;
                case "i":
                  Bitvectors = BvHandling.ToInt;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;

          case "-contractInfer":
          case "/contractInfer":
            ContractInfer = true;
            TheProverFactory = ProverFactory.Load("ContractInference");
            ProverName = "ContractInference".ToUpper();
            break;

          case "-subsumption":
          case "/subsumption": {
              int s = 0;
              if (ps.GetNumericArgument(ref s, 3)) {
                switch (s) {
                  case 0:
                    UseSubsumption = SubsumptionOption.Never;
                    break;
                  case 1:
                    UseSubsumption = SubsumptionOption.NotForQuantifiers;
                    break;
                  case 2:
                    UseSubsumption = SubsumptionOption.Always;
                    break;
                  default: {
                      Contract.Assert(false);
                      throw new cce.UnreachableException();
                    } // postcondition of GetNumericArgument guarantees that we don't get here
                }
              }
              break;
            }

          case "-liveVariableAnalysis":
          case "/liveVariableAnalysis": {
              int lva = 0;
              if (ps.GetNumericArgument(ref lva, 3)) {
                LiveVariableAnalysis = lva;
              }
              break;
            }

          case "-removeEmptyBlocks":
          case "/removeEmptyBlocks": {
              int reb = 0;
              if (ps.GetNumericArgument(ref reb, 2)) {
                RemoveEmptyBlocks = reb == 1;
              }
              break;
            }

          case "-coalesceBlocks":
          case "/coalesceBlocks": {
              int cb = 0;
              if (ps.GetNumericArgument(ref cb, 2)) {
                CoalesceBlocks = cb == 1;
              }
              break;
            }

          case "/DoomDebug":
            vcVariety = VCVariety.Doomed;
            useDoomDebug = true;
            break;

          case "-vc":
          case "/vc":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "s":
                case "structured":
                  vcVariety = VCVariety.Structured;
                  break;
                case "b":
                case "block":
                  vcVariety = VCVariety.Block;
                  break;
                case "l":
                case "local":
                  vcVariety = VCVariety.Local;
                  break;
                case "n":
                case "nested":
                  vcVariety = VCVariety.BlockNested;
                  break;
                case "m":
                  vcVariety = VCVariety.BlockNestedReach;
                  break;
                case "r":
                  vcVariety = VCVariety.BlockReach;
                  break;
                case "d":
                case "dag":
                  vcVariety = VCVariety.Dag;
                  break;
                case "doomed":
                  vcVariety = VCVariety.Doomed;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;

          case "-prover":
          case "/prover":
            if (ps.ConfirmArgumentCount(1)) {
              TheProverFactory = ProverFactory.Load(cce.NonNull(args[ps.i]));
              ProverName = cce.NonNull(args[ps.i]).ToUpper();
            }
            break;

          case "-p":
          case "/p":
          case "-proverOpt":
          case "/proverOpt":
            if (ps.ConfirmArgumentCount(1)) {
              ProverOptions.Add(cce.NonNull(args[ps.i]));
            }
            break;

          case "-extractLoops":
          case "/extractLoops":
            if (ps.ConfirmArgumentCount(0)) {
              ExtractLoops = true;
            }
            break;
          case "-inline":
          case "/inline":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "none":
                  ProcedureInlining = Inlining.None;
                  break;
                case "assert":
                  ProcedureInlining = Inlining.Assert;
                  break;
                case "assume":
                  ProcedureInlining = Inlining.Assume;
                  break;
                case "spec":
                  ProcedureInlining = Inlining.Spec;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;
          case "-lazyInline":
          case "/lazyInline":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "0":
                  LazyInlining = 0;
                  break;
                case "1":
                  LazyInlining = 1;
                  break;
                case "2":
                  LazyInlining = 2;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;
          case "-stratifiedInline":
          case "/stratifiedInline":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "0":
                  StratifiedInlining = 0;
                  break;
                case "1":
                  StratifiedInlining = 1;
                  break;
                default:
                  StratifiedInlining = Int32.Parse(cce.NonNull(args[ps.i]));
                  //ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;
          case "-recursionBound":
          case "/recursionBound": 
            if(ps.ConfirmArgumentCount(1)){
              RecursionBound = Int32.Parse(cce.NonNull(args[ps.i]));
            }
            break;
          case "-coverageReporter":
          case "/coverageReporter":
            if (ps.ConfirmArgumentCount(1)) {
              CoverageReporterPath = args[ps.i];
            }
            break;
          case "-stratifiedInlineOption":
          case "/stratifiedInlineOption":
            if (ps.ConfirmArgumentCount(1)) {
              StratifiedInliningOption=Int32.Parse(cce.NonNull(args[ps.i]));
            }
            break;
          case "-useUnsatCoreForInlining":
          case "/useUnsatCoreForInlining":
            UseUnsatCoreForInlining = true;
            break;
          case "-inferLeastForUnsat":
          case "/inferLeastForUnsat":
            if (ps.ConfirmArgumentCount(1))
            {
                inferLeastForUnsat = args[ps.i];
            }
            break;
          case "-typeEncoding":
          case "/typeEncoding":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "n":
                case "none":
                  TypeEncodingMethod = TypeEncoding.None;
                  break;
                case "p":
                case "predicates":
                  TypeEncodingMethod = TypeEncoding.Predicates;
                  break;
                case "a":
                case "arguments":
                  TypeEncodingMethod = TypeEncoding.Arguments;
                  break;
                case "m":
                case "monomorphic":
                  TypeEncodingMethod = TypeEncoding.Monomorphic;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;

          case "-instrumentInfer":
          case "/instrumentInfer":
            if (ps.ConfirmArgumentCount(1)) {
              switch (args[ps.i]) {
                case "e":
                  InstrumentInfer = InstrumentationPlaces.Everywhere;
                  break;
                case "h":
                  InstrumentInfer = InstrumentationPlaces.LoopHeaders;
                  break;
                default:
                  ps.Error("Invalid argument \"{0}\" to option {1}", args[ps.i], ps.s);
                  break;
              }
            }
            break;

          case "-vcBrackets":
          case "/vcBrackets":
            ps.GetNumericArgument(ref BracketIdsInVC, 2);
            break;

          case "-proverMemoryLimit":
          case "/proverMemoryLimit": {
              int d = 0;
              if (ps.GetNumericArgument(ref d)) {
                MaxProverMemory = d * Megabyte;
              }
              break;
            }

          case "-vcsMaxCost":
          case "/vcsMaxCost":
            ps.GetNumericArgument(ref VcsMaxCost);
            break;

          case "-vcsPathJoinMult":
          case "/vcsPathJoinMult":
            ps.GetNumericArgument(ref VcsPathJoinMult);
            break;

          case "-vcsPathCostMult":
          case "/vcsPathCostMult":
            ps.GetNumericArgument(ref VcsPathCostMult);
            break;

          case "-vcsAssumeMult":
          case "/vcsAssumeMult":
            ps.GetNumericArgument(ref VcsAssumeMult);
            break;

          case "-vcsPathSplitMult":
          case "/vcsPathSplitMult":
            ps.GetNumericArgument(ref VcsPathSplitMult);
            break;

          case "-vcsMaxSplits":
          case "/vcsMaxSplits":
            ps.GetNumericArgument(ref VcsMaxSplits);
            break;

          case "-vcsMaxKeepGoingSplits":
          case "/vcsMaxKeepGoingSplits":
            ps.GetNumericArgument(ref VcsMaxKeepGoingSplits);
            break;

          case "-vcsFinalAssertTimeout":
          case "/vcsFinalAssertTimeout":
            ps.GetNumericArgument(ref VcsFinalAssertTimeout);
            break;

          case "-vcsKeepGoingTimeout":
          case "/vcsKeepGoingTimeout":
            ps.GetNumericArgument(ref VcsKeepGoingTimeout);
            break;

          case "-vcsCores":
          case "/vcsCores":
            ps.GetNumericArgument(ref VcsCores);
            break;

          case "-simplifyMatchDepth":
          case "/simplifyMatchDepth":
            ps.GetNumericArgument(ref SimplifyProverMatchDepth);
            break;

          case "-timeLimit":
          case "/timeLimit":
            ps.GetNumericArgument(ref ProverKillTime);
            break;

          case "-smokeTimeout":
          case "/smokeTimeout":
            ps.GetNumericArgument(ref SmokeTimeout);
            break;

          case "-errorLimit":
          case "/errorLimit":
            ps.GetNumericArgument(ref ProverCCLimit);
            break;

          case "-z3opt":
          case "/z3opt":
            if (ps.ConfirmArgumentCount(1)) {
              Z3Options.Add(cce.NonNull(args[ps.i]));
            }
            break;

          case "-z3lets":
          case "/z3lets":
            ps.GetNumericArgument(ref Z3lets, 4);
            break;

          case "-platform":
          case "/platform":
            if (ps.ConfirmArgumentCount(1)) {
              StringCollection platformOptions = this.ParseNamedArgumentList(args[ps.i]);
              if (platformOptions != null && platformOptions.Count > 0) {
                try {
                  this.TargetPlatform = (PlatformType)cce.NonNull(Enum.Parse(typeof(PlatformType), cce.NonNull(platformOptions[0])));
                } catch {
                  ps.Error("Bad /platform type '{0}'", platformOptions[0]);
                  break;
                }
                if (platformOptions.Count > 1) {
                  this.TargetPlatformLocation = platformOptions[1];
                  if (!Directory.Exists(platformOptions[1])) {
                    ps.Error("/platform directory '{0}' does not exist", platformOptions[1]);
                    break;
                  }
                }
              }
            }
            break;

          case "-stdlib":
          case "/stdlib":
            if (ps.ConfirmArgumentCount(1)) {
              this.StandardLibraryLocation = args[ps.i];
            }
            break;

          case "-Houdini":
          case "/Houdini":
            this.houdiniEnabled = true;
            if (ps.hasColonArgument) {
              if (ps.ConfirmArgumentCount(1)) {
                foreach (char c in cce.NonNull(args[ps.i])) {
                  switch (c) {
                    case 'c':
                      houdiniFlags.continueAtError = true;
                      break;
                    case 'i':
                      houdiniFlags.incremental = true;
                      break;
                    default:
                      ps.Error("Unknown houdini flag: " + c + "\n");
                      break;
                  }
                }
              }
            }
            break;

          default:
            Contract.Assume(true);
            bool option = false;
            if (ps.CheckBooleanFlag("printUnstructured", ref option)) {
              cce.BeginExpose(this);
              {
                PrintUnstructured = option ? 1 : 0;
              }
              cce.EndExpose();
            } else if (
              ps.CheckBooleanFlag("printDesugared", ref PrintDesugarings) ||
              ps.CheckBooleanFlag("printInstrumented", ref PrintInstrumented) ||
              ps.CheckBooleanFlag("printWithUniqueIds", ref PrintWithUniqueASTIds) ||
              ps.CheckBooleanFlag("wait", ref Wait) ||
              ps.CheckBooleanFlag("trace", ref Trace) ||
              ps.CheckBooleanFlag("traceTimes", ref TraceTimes) ||
              ps.CheckBooleanFlag("noResolve", ref NoResolve) ||
              ps.CheckBooleanFlag("noTypecheck", ref NoTypecheck) ||
              ps.CheckBooleanFlag("overlookTypeErrors", ref OverlookBoogieTypeErrors) ||
              ps.CheckBooleanFlag("noVerify", ref Verify, false) ||
              ps.CheckBooleanFlag("traceverify", ref TraceVerify) ||
              ps.CheckBooleanFlag("noConsistencyChecks", ref noConsistencyChecks, true) ||
              ps.CheckBooleanFlag("alwaysAssumeFreeLoopInvariants", ref AlwaysAssumeFreeLoopInvariants, true) ||
              ps.CheckBooleanFlag("nologo", ref DontShowLogo) ||
              ps.CheckBooleanFlag("noVerifyByDefault", ref NoVerifyByDefault) ||
              ps.CheckBooleanFlag("useUncheckedContracts", ref UseUncheckedContracts) ||
              ps.CheckBooleanFlag("proverLogAppend", ref SimplifyLogFileAppend) ||
              ps.CheckBooleanFlag("checkInfer", ref InstrumentWithAsserts) ||
              ps.CheckBooleanFlag("interprocInfer", ref IntraproceduralInfer, false) ||
              ps.CheckBooleanFlag("restartProver", ref RestartProverPerVC) ||
              ps.CheckBooleanFlag("printInlined", ref PrintInlined) ||
              ps.CheckBooleanFlag("arithDistributionAxioms", ref UseArithDistributionAxioms) ||
              ps.CheckBooleanFlag("smoke", ref SoundnessSmokeTest) ||
              ps.CheckBooleanFlag("vcsDumpSplits", ref VcsDumpSplits) ||
              ps.CheckBooleanFlag("dbgRefuted", ref DebugRefuted) ||
              ps.CheckBooleanFlag("causalImplies", ref CausalImplies) ||
              ps.CheckBooleanFlag("reflectAdd", ref ReflectAdd) ||
              ps.CheckBooleanFlag("z3types", ref Z3types) ||
              ps.CheckBooleanFlag("z3multipleErrors", ref z3AtFlag, false) ||
              ps.CheckBooleanFlag("monomorphize", ref Monomorphize) ||
              ps.CheckBooleanFlag("useArrayTheory", ref UseArrayTheory) ||
              ps.CheckBooleanFlag("doModSetAnalysis", ref DoModSetAnalysis)
              ) {
              // one of the boolean flags matched
            } else if (ps.s.StartsWith("-") || ps.s.StartsWith("/")) {
              ps.Error("unknown switch: {0}", ps.s);
            } else if (ps.ConfirmArgumentCount(0)) {
              string filename = ps.s;
              string extension = Path.GetExtension(filename);
              if (extension != null) {
                InputFileExtension = extension.ToLower();
              }
              Files.Add(filename);
              FileName = filename;
            }
            break;
        }
        cce.BeginExpose(ps);
        ps.i = ps.nextIndex;
        cce.EndExpose();
      }

      Contract.Assume(true);
      if (ps.encounteredErrors)
        res *= 2;
      if (res < 0) {  // help requested
        Usage();
      } else if (AttrHelpRequested) {
        AttributeUsage();
      } else if (ps.encounteredErrors) {
        Console.WriteLine("Use /help for available options");
      }

      SetProverOptions();

      if (Trace) {
        BoogieDebug.DoPrinting = true;
      } // reuse the -trace option for debug printing
      return res;
    }

    private void SetProverOptions() {
      //modifies this.*;
      Contract.Ensures(TheProverFactory != null);
      Contract.Ensures(vcVariety != VCVariety.Unspecified);
      // expand macros in filenames, now that LogPrefix is fully determined
      ExpandFilename(ref XmlSinkFilename);
      ExpandFilename(ref PrintFile);
      ExpandFilename(ref DafnyPrelude);
      ExpandFilename(ref DafnyPrintFile);
      ExpandFilename(ref SimplifyLogFilePath);
      ExpandFilename(ref PrintErrorModelFile);

      Contract.Assume(XmlSink == null);  // XmlSink is to be set here
      if (XmlSinkFilename != null) {
        XmlSink = new XmlSink(XmlSinkFilename);
      }

      if (TheProverFactory == null) {
        cce.BeginExpose(this);
        {
          TheProverFactory = ProverFactory.Load("Z3");
          ProverName = "Z3".ToUpper();
        }
        cce.EndExpose();
      }

      if (vcVariety == VCVariety.Unspecified) {
        vcVariety = TheProverFactory.DefaultVCVariety;
      }

      if (LoopFrameConditions == -1) {
        // /modifiesOnLoop not specified.  Set its default depending on /localModifiesChecks
        if (LocalModifiesChecks) {
          LoopFrameConditions = 1;
        } else {
          LoopFrameConditions = 2;
        }
      }

      switch (InductiveMinMax) {
        case 1:
        case 2:
        case 4:
        case 5:
          ReflectAdd = true;  // these InductiveMinMax modes imply ReflectAdd
          break;
        default:
          break;
      }

      if (MethodologySelection == Methodology.VisibleState) {
        OwnershipModelEncoding = OwnershipModelOption.Trivial;
      }

      if (UseArrayTheory) {
        Monomorphize = true;
      }

      if (LazyInlining > 0) {
        TypeEncodingMethod = TypeEncoding.Monomorphic;
        UseArrayTheory = true;
        UseAbstractInterpretation = false;
      }

      if (inferLeastForUnsat != null)
      {
          StratifiedInlining = 1;
      }

      if (StratifiedInlining > 0) {
        TypeEncodingMethod = TypeEncoding.Monomorphic;
        UseArrayTheory = true;
        UseAbstractInterpretation = false;
        if (ProverName == "Z3API")
        {
            ProverCCLimit = 1;
        }
      }
    }



    public bool UserWantsMethodLogging(string methodFullName) {
      Contract.Requires(methodFullName != null);
      if (methodToLog == null) {
        return false;
      }
      return methodToLog == "*" || methodFullName.IndexOf(methodToLog) >= 0;
    }

    public bool UserWantsToBreak(string methodFullName) {
      Contract.Requires(methodFullName != null);
      if (methodToBreakOn == null) {
        return false;
      }
      return methodFullName.IndexOf(methodToBreakOn) >= 0;
    }

    public bool UserWantsToCheckRoutine(string methodFullname) {
      Contract.Requires(methodFullname != null);
      if (procsToCheck == null) {
        // no preference
        return true;
      }
      return Contract.Exists(procsToCheck, s => 0 <= methodFullname.IndexOf(s));
    }

#if CCI
    public bool UserWantsToTranslateRoutine(Cci.Method method, string methodFullname) {
      Contract.Requires(methodFullname != null);
      Contract.Requires(method != null);
      return UserWantsToTranslateRoutineInclude(method, methodFullname) &&
        !Contract.Exists(methodsToTranslateExclude, s => 0 <= methodFullname.IndexOf(s));
    }

    public bool UserWantsToTranslateRoutineInclude(Cci.Method method, string methodFullname) {
      Contract.Requires(methodFullname != null);
      Contract.Requires(method != null);
      if (methodsToTranslateSubstring == null &&
          methodsToTranslateClass == null &&
          methodsToTranslateClassQualified == null &&
          methodsToTranslateFile == null &&
          methodsToTranslateMethod == null &&
          methodsToTranslateMethodQualified == null) {
        // no preference
        return true;
      }
      if (methodsToTranslateSubstring != null) {
        if (Contract.Exists(methodsToTranslateSubstring, s => 0 <= methodFullname.IndexOf(s))) {
          return true;
        }
      }
      if (methodsToTranslateMethod != null) {
        string methodName = method.Name.Name;
        Contract.Assert(methodsToTranslateMethod != null);
        if (methodsToTranslateMethod.Contains(methodName)) {
          return true;
        }
      }
      if (methodsToTranslateMethodQualified != null && method.DeclaringType != null) {
        string methodName = method.DeclaringType.Name.Name + "." + method.Name.Name;
        Contract.Assert(methodsToTranslateMethodQualified != null);
        if (methodsToTranslateMethodQualified.Contains(methodName)) {
          return true;
        }
      }
      if (method.DeclaringType != null) {
        if (methodsToTranslateClass != null) {
          string className = method.DeclaringType.Name.Name;
          if (methodsToTranslateClass.Contains(className)) {
            return true;
          }
        }
        if (methodsToTranslateClassQualified != null) {
          string className = method.DeclaringType.FullName;
          if (className != null) {
            className = className.Replace('+', '.');
            if (methodsToTranslateClassQualified.Contains(className)) {
              return true;
            }
          }
        }
      }
      if (methodsToTranslateFile != null) {
        string methodFilename = GetSourceDocument(method);
        if (methodFilename != null) {
          string path = methodFilename;
          if (path != null) {
            string filename = Path.GetFileName(path);
            if (methodsToTranslateFile.Contains(filename)) {
              return true;
            }
          }
        }
      }
      // the method is not among the desired routines
      return false;
    }

    /// <summary>
    /// Returns the file containing "method".  Returns null f that information is not available.
    /// </summary>
    static string GetSourceDocument(Cci.Method method) {
      Contract.Requires(method != null);
      // Start by looking for a source context in the method itself.  However, if the program
      // was read from a binary, then there is no source location for the method.  If so, there
      // some other ways we might find a source location.
      if (method.SourceContext.Document != null) {
        return method.SourceContext.Document.Name;
      }
      // Try to find a source location in the method's contract
      if (method.Contract != null) {
        if (method.Contract.Requires != null) {
          foreach (Cci.Requires c in method.Contract.Requires) {
            if (c != null && c.SourceContext.Document != null) {
              return c.SourceContext.Document.Name;
            }
          }
        }
        if (method.Contract.Modifies != null) {
          foreach (Cci.Expression c in method.Contract.Modifies) {
            if (c != null && c.SourceContext.Document != null) {
              return c.SourceContext.Document.Name;
            }
          }
        }
        if (method.Contract.Ensures != null) {
          foreach (Cci.Ensures c in method.Contract.Ensures) {
            if (c != null && c.SourceContext.Document != null) {
              return c.SourceContext.Document.Name;
            }
          }
        }
      }
      // As a last attempt, look for a source location among the statements
      if (method.Body != null) {
        return GetSourceDocumentFromStatements(method.Body.Statements);
      }
      return null;  // no source location found
    }

    [Pure]
    static string GetSourceDocumentFromStatements(Cci.StatementList list) {
      if (list != null) {
        foreach (Cci.Statement c in list) {
          if (c != null && c.SourceContext.Document != null) {
            return c.SourceContext.Document.Name;
          }
          if (c is Cci.Block) {
            Cci.Block b = (Cci.Block)c;
            string n = GetSourceDocumentFromStatements(b.Statements);
            if (n != null) {
              return n;
            }
          }
        }
      }
      return null;
    }
#endif

    class CommandLineParseState {
      public string s;
      public bool hasColonArgument;
      public readonly string[]/*!*/ args;
      public int i;
      public int nextIndex;
      public bool encounteredErrors;
      [ContractInvariantMethod]
      void ObjectInvariant() {
        Contract.Invariant(args != null);
        Contract.Invariant(0 <= i && i <= args.Length);
        Contract.Invariant(0 <= nextIndex && nextIndex <= args.Length);

      }



      public CommandLineParseState(string[] args) {
        Contract.Requires(args != null);
        Contract.Requires(Contract.ForAll(0, args.Length, i => args[i] != null));
        Contract.Ensures(this.args == args);
        this.s = null;  // set later by client
        this.hasColonArgument = false;  // set later by client
        this.args = args;
        this.i = 0;
        this.nextIndex = 0;  // set later by client
        this.encounteredErrors = false;
      }

      public bool CheckBooleanFlag(string flagName, ref bool flag, bool valueWhenPresent) {
        Contract.Requires(flagName != null);
        //modifies nextIndex, encounteredErrors, Console.Error.*;
        bool flagPresent = false;

        if ((s == "/" + flagName || s == "-" + flagName) && ConfirmArgumentCount(0)) {
          flag = valueWhenPresent;
          flagPresent = true;
        }
        return flagPresent;
      }

      public bool CheckBooleanFlag(string flagName, ref bool flag) {
        Contract.Requires(flagName != null);
        //modifies nextIndex, encounteredErrors, Console.Error.*;
        return CheckBooleanFlag(flagName, ref flag, true);
      }

      /// <summary>
      /// If there is one argument and it is a non-negative integer, then set "arg" to that number and return "true".
      /// Otherwise, emit error message, leave "arg" unchanged, and return "false".
      /// </summary>
      public bool GetNumericArgument(ref int arg) {
        //modifies nextIndex, encounteredErrors, Console.Error.*;
        if (this.ConfirmArgumentCount(1)) {
          try {
            Contract.Assume(args[i] != null);
            Contract.Assert(args[i] is string);  // needed to prove args[i].IsPeerConsistent
            int d = Convert.ToInt32(this.args[this.i]);
            if (0 <= d) {
              arg = d;
              return true;
            }
          } catch (System.FormatException) {
          } catch (System.OverflowException) {
          }
        } else {
          return false;
        }
        Error("Invalid argument \"{0}\" to option {1}", args[this.i], this.s);
        return false;
      }

      /// <summary>
      /// If there is one argument and it is a non-negative integer less than "limit",
      /// then set "arg" to that number and return "true".
      /// Otherwise, emit error message, leave "arg" unchanged, and return "false".
      /// </summary>
      public bool GetNumericArgument(ref int arg, int limit) {
        Contract.Requires(this.i < args.Length);
        //modifies nextIndex, encounteredErrors, Console.Error.*;
        int a = arg;
        if (!GetNumericArgument(ref a)) {
          return false;
        } else if (a < limit) {
          arg = a;
          return true;
        } else {
          Error("Invalid argument \"{0}\" to option {1}", args[this.i], this.s);
          return false;
        }
      }

      /// <summary>
      /// If there is one argument and it is a non-negative real, then set "arg" to that number and return "true".
      /// Otherwise, emit an error message, leave "arg" unchanged, and return "false".
      /// </summary>
      public bool GetNumericArgument(ref double arg) {
        //modifies nextIndex, encounteredErrors, Console.Error.*;
        if (this.ConfirmArgumentCount(1)) {
          try {
            Contract.Assume(args[i] != null);
            Contract.Assert(args[i] is string);  // needed to prove args[i].IsPeerConsistent
            double d = Convert.ToDouble(this.args[this.i]);
            if (0 <= d) {
              arg = d;
              return true;
            }
          } catch (System.FormatException) {
          } catch (System.OverflowException) {
          }
        } else {
          return false;
        }
        Error("Invalid argument \"{0}\" to option {1}", args[this.i], this.s);
        return false;
      }

      public bool ConfirmArgumentCount(int argCount) {
        Contract.Requires(0 <= argCount);
        //modifies nextIndex, encounteredErrors, Console.Error.*;
        Contract.Ensures(Contract.Result<bool>() == (!(hasColonArgument && argCount != 1) && !(args.Length < i + argCount)));
        if (hasColonArgument && argCount != 1) {
          Error("\"{0}\" cannot take a colon argument", s);
          nextIndex = args.Length;
          return false;
        } else if (args.Length < i + argCount) {
          Error("\"{0}\" expects {1} argument{2}", s, argCount.ToString(), (string)(argCount == 1 ? "" : "s"));
          nextIndex = args.Length;
          return false;
        } else {
          nextIndex = i + argCount;
          return true;
        }
      }

      public void Error(string message, params string[] args) {
        Contract.Requires(args != null);
        Contract.Requires(message != null);
        //modifies encounteredErrors, Console.Error.*;
        Console.Error.WriteLine("Boogie: Error: " + String.Format(message, args));
        encounteredErrors = true;
      }
    }

    public virtual StringCollection ParseNamedArgumentList(string argList) {
      if (argList == null || argList.Length == 0)
        return null;
      StringCollection result = new StringCollection();
      int i = 0;
      for (int n = argList.Length; i < n; ) {
        cce.LoopInvariant(0 <= i);
        int separatorIndex = this.GetArgumentSeparatorIndex(argList, i);
        if (separatorIndex > i) {
          result.Add(argList.Substring(i, separatorIndex - i));
          i = separatorIndex + 1;
          continue;
        }
        result.Add(argList.Substring(i));
        break;
      }
      return result;
    }
    public int GetArgumentSeparatorIndex(string argList, int startIndex) {
      Contract.Requires(argList != null);
      Contract.Requires(0 <= startIndex && startIndex <= argList.Length);
      Contract.Ensures(Contract.Result<int>() < argList.Length);
      int commaIndex = argList.IndexOf(",", startIndex);
      int semicolonIndex = argList.IndexOf(";", startIndex);
      if (commaIndex == -1)
        return semicolonIndex;
      if (semicolonIndex == -1)
        return commaIndex;
      if (commaIndex < semicolonIndex)
        return commaIndex;
      return semicolonIndex;
    }

    public static void AttributeUsage() {
      Console.WriteLine(
@"Boogie: The following attributes are supported by this implementation.

  ---- On axioms -------------------------------------------------------------

    {:inline true}
      Works on axiom of the form: 
        (forall VARS :: f(VARS) = expr(VARS))
      Makes Boogie replace f(VARS) with expr(VARS) everywhere just before
      doing VC generation.

    {:ignore ""p,q..""}
      Exclude the axiom when generating VC for a prover supporting any
      of the features 'p', 'q', ...
      All the provers support the feature 'all'.
      Simplify supports 'simplify' and 'simplifyLike'.
      Z3 supports 'z3', 'simplifyLike' and either 'bvInt' (if the /bv:i
      option is passed) or 'bvDefSem' (for /bv:z).

  ---- On implementations and procedures -------------------------------------

     {:inline N}
       Inline given procedure (can be also used on implementation). 
       N should be a non-negative number and represents the inlining depth. 
       With /inline:assume call is replaced with ""assume false"" once inlining depth is reached.
       With /inline:assert call is replaced with ""assert false"" once inlining depth is reached.
       With /inline:spec call is left as is once inlining depth is reached.
       With the above three options, methods with the attribute {:inline N} are not verified.
       With /inline:none the entire attribute is ignored. 
       
     {:verify false}
       Skip verification of an implementation.
       
     {:forceBvZ3Native true}
       Verify the given implementation with the native Z3 bitvector
       handling. Only works if /bv:i (or /bv:z, but then it does not do
       anything) is given on the command line.
       
     {:forceBvInt true}
       Use int translation for the given implementation. Only work with
       /bv:z (or /bv:i).
       
     {:vcs_max_cost N}
     {:vcs_max_splits N}
     {:vcs_max_keep_going_splits N}
       Per-implementation versions of 
       /vcsMaxCost, /vcsMaxSplits and /vcsMaxKeepGoingSplits.

     {:selective_checking true}
       Turn all asserts into assumes except for the ones reachable from
       assumptions marked with the attribute {:start_checking_here}.
       Thus, ""assume {:start_checking_here} something;"" becomes an inverse 
       of ""assume false;"": the first one disables all verification before
       it, and the second one disables all verification after.

  ---- On functions ----------------------------------------------------------

     {:bvbuiltin ""spec""}
       Z3 specific, used only with /bv:z.
       
     {:bvint ""fn""}
       With /bv:i rewrite the function to function symbol 'fn', except if
       the 'fn' is 'id', in which case just strip the function altogether.

     {:never_pattern true}
       Terms starting with this function symbol will never be
       automatically selected as patterns. It does not prevent them
       from being used inside the triggers, and does not affect explicit
       trigger annotations. Internally it works by adding {:nopats ...}
       annotations to quantifiers.

  ---- On variables ----------------------------------------------------------

     {:existential true}
       Marks a global Boolean variable as existentially quantified. If
       used in combination with option /contractInfer Boogie will check
       whether there exists a Boolean assignment to the existentials
       that makes all verification conditions valid.  Without option
       /contractInfer the attribute is ignored.

  ---- On assert statements --------------------------------------------------

     {:subsumption n}
       Overrides the /subsumption command-line setting for this assertion.
       
  ---- The end ---------------------------------------------------------------
");
    }

    private static bool printedHelp = false;

    public static void Usage() {
      // Ensure that we only print the help message once,
      // no matter how many enabling conditions for printing
      // help were triggered.
      if (printedHelp) {
        return;
      }
      printedHelp = true;

      Console.WriteLine(@"Boogie: usage:  Boogie [ option ... ] [ filename ... ]
  where <option> is one of

  ---- General options -------------------------------------------------------

  /help          : this message
  /attrHelp      : print a message about declaration attributes supported by
                   this implementation
  /nologo        : suppress printing of version number, copyright message
  /env:<n>       : print command line arguments
                   0 - never, 1 (default) - during BPL print and prover log,
                   2 - like 1 and also to standard output
  /wait          : await Enter from keyboard before terminating program
  /xml:<file>    : also produce output in XML format to <file>

  ---- Spec# options ---------------------------------------------------------

  If any of the following switches is included, only those methods specified
  by some switch are translated into Boogie.  Furthermore, a method is
  not translated if a [Verify(false)] attribute applies to it or if the
  flag /trExclude applies (see below).
  /translate:<str> : include method if its full name contains substring <str>
  /trMethod:<method> : include method if its name is <method>
                       Format:  Name or Class.Name
  /trClass:<class>   : include method if the enclosing class is <class>
                       Format:  Name or Qualification.Name
  /trFile:<filename> : include method if it is contained in file <filename>
                       Format:  Filename.ssc

  /trExclude:<str> : exclude method it its full name contains substring <str>

  /c[ontracts]:<file>
                 : apply the contracts from <file> to
                   the referenced assemblies of the input assembly.
                   Note: the contracts for Xyz must be in Xyz.Contracts
  /methodology:<m> : selects the specification and verification methodology
                   b = boogie (default)
                   vs = visible-state
  /level:<n>     : 0 - reduced checks,
                   1 - no modifies checking, 2 - full (default)
  /useUncheckedContracts : generate purity axioms even when the postconditions
                   could not be checked to be sound (this option only for
                   experts and dare devils)
  /modifiesDefault:<n> :
                   0 - just what is declared
                   1 - what is declared plus E.snapshot for every top-level
                       E.f, E.*, E.**, E[i], or E[*] in the modifies clause
                   2 - (1) but also for nested E's
                   3 - (1) plus this.snapshot
                   4 - (2) plus this.snapshot
                   5 - (default) (1) plus p.* for receiver parameter p not
                       occurring at the top-level of modifies clause as
                       p.f, p.*, p.**, p[i], p[*], or p.0
                   6 - (5) but for every parameter p
  /modifiesOnLoop:<n> : 0 - never, 1 - assume only (default),
                        2 - assume and check (default with
                            /localModifiesChecks:0)
  /localModifiesChecks: 0 - check modifies-clause as post-condition of a
                            procedure
                        1 - check violations of modifies-clause at each
                            assignment and method call (default)
  /loopUnroll:<n>  : unroll loops, following up to n back edges (and then some)
  /noVerifyByDefault : change the default to [Verify(false)]
  /orderStrength:<n> : 0 (default) - only few properties of subtyping
                                     axiomatized,
                       1 - full strength
  /summationStrength:<n> : 0 - less applicable triggers in the axioms
                           1 - (default) default set of axioms for summation-
                           like quantifiers;
  /arithDistributionAxioms : emit +/* distribution axioms
  /inductiveMinMax:<n> : 0 (default) - extreme axioms for min/max;
                         1 - inductive axioms for min/max;
                         2 - both extreme and inductive axioms for min/max
                         3,4,5 - like 0,1,2 but adding the plus-over-min/max
                             distribution axiom
                         Modes 1,2,4,5 imply /reflectAdd.
  /fcoStrength:<n> : adjusts the amount of information encoded about 'first
                     consistent owners'
                     0 - no FCO axiom, 1 - cheaper but weaker FCO axiom,
                     2 - pure-method FCO axiom,
                     3, 4, 5 (default) - like 0,1,2 plus more specific
                       FCO information on pure-method return
  /ownerModelEncoding:<enc> : s = standard (default)
                              e = experimental
                              t = trivial (implied by /methodology:vs)
  /printModel:<n> : 0 (default) - do not print Z3's error model
                    1 - print Z3's error model
                    2 - print Z3's error model plus reverse mappings         
                    4 - print Z3's error model in a more human readable way
  /printModelToFile:<file> : print model to <file> instead of console
  /mv:<file>        Specify file where to save the model in BVD format
  /enhancedErrorMessages:<n> : 0 (default) - no enhanced error messages
                               1 - Z3 error model enhanced error messages

  ---- Dafny options ---------------------------------------------------------
  
  Multiple .dfy files supplied on the command line are concatenated into one
  Dafny program.

  /dprelude:<file> : choose Dafny prelude file
  /dprint:<file> : print Dafny program after parsing it
                   (use - as <file> to print to console)
  /compile:<n>   : 0 - do not compile Dafny program
                   1 (default) - upon successful verification of the Dafny
                       program, compile Dafny program to C# program out.cs

  ---- Boogie options --------------------------------------------------------

  Multiple .bpl files supplied on the command line are concatenated into one
  Boogie program.

  /proc:<p>      : limits which procedures to check
  /noResolve     : parse only
  /noTypecheck   : parse and resolve only

  /print:<file>  : print Boogie program after parsing it
                   (use - as <file> to print to console)
  /printWithUniqueIds : print augmented information that uniquely
                   identifies variables
  /printUnstructured : with /print option, desugars all structured statements
  /printDesugared : with /print option, desugars calls
  
  /overlookTypeErrors : skip any implementation with resolution or type
                        checking errors

  ---- Inference options -----------------------------------------------------

  /infer:<flags> : use abstract interpretation to infer invariants
                   The default is /infer:i"
        // This is not 100% true, as the /infer ALWAYS creates
        // a multilattice, whereas if nothing is specified then
        // intervals are isntantiated WITHOUT being embedded in
        // a multilattice
                                          + @"
                   <flags> are as follows (missing <flags> means all)
                   i = intervals
                   c = constant propagation        
                   d = dynamic type
                   n = nullness
                   p = polyhedra for linear inequalities
                   s = debug statistics
                0..9 = number of iterations before applying a widen (default=0)
  /noinfer       : turn off the default inference, and overrides the /infer
                   switch on its left
  /checkInfer    : instrument inferred invariants as asserts to be checked by
                   theorem prover
  /interprocInfer : perform interprocedural inference (deprecated, not
                    supported)
  /contractInfer : perform procedure contract inference
  /logInfer      : print debug output during inference
  /instrumentInfer : h - instrument inferred invariants only at beginning of
                         loop headers (default)
                     e - instrument inferred invariants at beginning and end
                         of every block
  /printInstrumented : print Boogie program after it has been
                   instrumented with invariants
  /Houdini[:<flags>] : perform procedure Houdini
                     c = continue when an error found
                     i = use incremental queries
  /dbgRefuted    : log refuted Houdini candidates to XmlSink

  ---- Debugging and general tracing options ---------------------------------

  /trace         : blurt out various debug trace information
  /traceTimes    : output timing information at certain points in the pipeline
  /log[:method]  : Print debug output during translation

  /break[:method] : break into debugger

  ---- Verification-condition generation options -----------------------------
  
  /liveVariableAnalysis:<c> : 0 = do not perform live variable analysis 
                              1 = perform live variable analysis (default)
                              2 = perform interprocedural live variable analysis
  /noVerify      : skip VC generation and invocation of the theorem prover
  /removeEmptyBlocks:<c> : 0 - do not remove empty blocks during VC generation
                           1 - remove empty blocks (default)
  /coalesceBlocks:<c> : 0 = do not coalesce blocks
                        1 = coalesce blocks (default)
  /vc:<variety>  : n = nested block (default for non-/prover:z3),
                   m = nested block reach,
                   b = flat block, r = flat block reach,
                   s = structured, l = local, d = dag (default with /prover:z3)
                   doomed = doomed
  /DoomDebug     : Use Doom detection to debug (experimental)               
  /traceverify   : print debug output during verification condition generation
  /subsumption:<c> : apply subsumption to asserted conditions:
                    0 - never, 1 - not for quantifiers, 2 (default) - always
  /alwaysAssumeFreeLoopInvariants : usually, a free loop invariant (or assume
                   statement in that position) is ignored in checking contexts
                   (like other free things); this option includes these free
                   loop invariants as assumes in both contexts
  /bv:<bv>       : bitvector handling
                   n = none
                   z = native Z3 bitvectors (default)
                   i = unsoundly translate bitvectors to integers
  /inline:<i>    : use inlining strategy <i> for procedures with the :inline 
                   attribute, see /attrHelp for details:
                   none
                   assume (default)
                   assert
                   spec
  /printInlined  : print the implementation after inlining calls to 
                   procedures with the :inline attribute (works with /inline)
  /lazyInline:1  : Use the lazy inlining algorithm
  /stratifiedInline:1 : Use the stratified inlining algorithm
  /recursionBound:<n> : Set the recursion bound for stratified inlining to 
                        be n (default 500)
  /inferLeastForUnsat:<str> : Infer the least number of constants (whose names
                              are prefixed by <str>) that need to be set to 
                              true for the program to be correct. This turns
                              on stratified inlining.
  /smoke         : Soundness Smoke Test: try to stick assert false; in some 
                   places in the BPL and see if we can still prove it
  /smokeTimeout:<n> : Timeout, in seconds, for a single theorem prover 
                   invocation during smoke test, defaults to 10.
  /causalImplies : Translate Boogie's A ==> B into prover's A ==> A && B.
  /typeEncoding:<m> : how to encode types when sending VC to theorem prover
                   n = none (unsound)
                   p = predicates (default)
                   a = arguments
  /monomorphize    Do not abstract map types in the encoding (this is an
                   experimental feature that will not do the right thing if
                   the program uses polymorphism)
  /reflectAdd      In the VC, generate an auxiliary symbol, elsewhere defined
                   to be +, instead of +.

  ---- Verification-condition splitting --------------------------------------

  /vcsMaxCost:<f>   : VC will not be split unless the cost of a VC exceeds this
                      number, defaults to 2000.0. This does NOT apply in the
                      keep-going mode after first round of splitting.
  /vcsMaxSplits:<n> : Maximal number of VC generated per method. In keep 
                      going mode only applies to the first round.
                      Defaults to 1.
  /vcsMaxKeepGoingSplits:<n> : If set to more than 1, activates the keep 
                      going mode, where after the first round of splitting,
                      VCs that timed out are split into <n> pieces and retried
                      until we succeed proving them, or there is only one 
                      assertion on a single path and it timeouts (in which
                      case error is reported for that assertion). 
                      Defaults to 1.
  /vcsKeepGoingTimeout:<n> : Timeout in seconds for a single theorem prover
                      invocation in keep going mode, except for the final
                      single-assertion case. Defaults to 1s.
  /vcsFinalAssertTimeout:<n> : Timeout in seconds for the single last 
                      assertion in the keep going mode. Defaults to 30s.
  /vcsPathJoinMult:<f> : If more than one path join at a block, by how much
                      multiply the number of paths in that block, to accomodate
                      for the fact that the prover will learn something on one
                      paths, before proceeding to another. Defaults to 0.8.
  /vcsPathCostMult:<f1>
  /vcsAssumeMult:<f2> : The cost of a block is 
         (<assert-cost> + <f2>*<assume-cost>)*(1.0 + <f1>*<entering-paths>)
                      <f1> defaults to 1.0, <f2> defaults to 0.01.
                      The cost of a single assertion or assumption is 
                      currently always 1.0.
  /vcsPathSplitMult:<f> : If the best path split of a VC of cost A is into 
                      VCs of cost B and C, then the split is applied if
                      A >= <f>*(B+C), otherwise assertion splitting will be 
                      applied. Defaults to 0.5 (always do path splitting if 
                      possible), set to more to do less path splitting
                      and more assertion splitting.
  /vcsDumpSplits      For split #n dump split.n.dot and split.n.bpl. 
                      Warning: Affects error reporting.
  /vcsCores:<n>     : Try to verify <n> VCs at once. Defaults to 1.

  ---- Prover options --------------------------------------------------------

  /errorLimit:<num> : Limit the number of errors produced for each procedure
                      (default is 5, some provers may support only 1)
  /timeLimit:<num>  : Limit the number of seconds spent trying to verify
                      each procedure
  /errorTrace:<n> : 0 - no Trace labels in the error output,
                    1 (default) - include useful Trace labels in error output,
                    2 - include all Trace labels in the error output
  /vcBrackets:<b> : bracket odd-charactered identifier names with |'s.  <b> is:
                   0 - no (default with /prover:Z3), 
                   1 - yes (default with /prover:Simplify)
  /prover:<tp>   : use theorem prover <tp>, where <tp> is either the name of
                   a DLL containing the prover interface located in the 
                   Boogie directory, or a full path to a DLL containing such
                   an interface. The standard interfaces shipped include:
                   Z3 (default)
                   Simplify
                   SMTLib (only writes to a file)
                   ContractInference (uses Z3)
                   Z3api (Z3 using Managed .NET API)
  /proverOpt:KEY[=VALUE] : Provide a prover-specific option (short form /p).
  /proverLog:<file> : Log input for the theorem prover.  Like filenames
                   supplied as arguments to other options, <file> can use the
                   following macros:
                     @TIME@    expands to the current time
                     @PREFIX@  expands to the concatenation of strings given
                               by /logPrefix options
                     @FILE@    expands to the last filename specified on the
                               command line
                   In addition, /proverLog can also use the macro '@PROC@',
                   which causes there to be one prover log file per
                   verification condition, and the macro then expands to the
                   name of the procedure that the verification condition is
                   for.
  /logPrefix:<str> : Defines the expansion of the macro '@PREFIX@', which can
                   be used in various filenames specified by other options.
  /proverLogAppend : Append (not overwrite) the specified prover log file
  /proverWarnings : 0 (default) - don't print, 1 - print to stdout,
                    2 - print to stderr
  /proverMemoryLimit:<num>  : Limit on the virtual memory for prover before
                             restart in MB (default:100MB)
  /restartProver            : Restart the prover after each query
  /proverShutdownLimit<num> : Time between closing the stream to the prover and
                              killing the prover process (default: 0s)
  /platform:<ptype>,<location>
                 : ptype = v11,v2,cli1
                 : location = platform libraries directory

  Simplify specific options:
  /simplifyMatchDepth:<num> : Set Simplify prover's matching depth limit

  Z3 specific options:
  /z3opt:<arg>   : specify additional Z3 options
  /z3multipleErrors : report multiple counterexamples for each error
  /useArrayTheory : use Z3's native theory (as opposed to axioms).  Currently
                    implies /monomorphize.

  /z3types       : generate multi-sorted VC that make use of Z3 types
  /z3lets:<n>    : 0 - no LETs, 1 - only LET TERM, 2 - only LET FORMULA,
                   3 - (default) any
");
    }
  }
}