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
use codespan_reporting::diagnostic::Severity;
use move_model::model::{GlobalEnv, VerificationScope};
use serde::{Deserialize, Serialize};
use std::rc::Rc;
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
pub enum AutoTraceLevel {
Off,
VerifiedFunction,
AllFunctions,
}
impl AutoTraceLevel {
pub fn verified_functions(self) -> bool {
use AutoTraceLevel::*;
matches!(self, VerifiedFunction | AllFunctions)
}
pub fn functions(self) -> bool {
use AutoTraceLevel::*;
matches!(self, AllFunctions)
}
pub fn invariants(self) -> bool {
use AutoTraceLevel::*;
matches!(self, VerifiedFunction | AllFunctions)
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default, deny_unknown_fields)]
pub struct ProverOptions {
pub generate_only: bool,
pub native_stubs: bool,
pub minimize_execution_trace: bool,
pub omit_model_debug: bool,
pub stable_test_output: bool,
pub verify_scope: VerificationScope,
pub resource_wellformed_axiom: bool,
pub assume_wellformed_on_access: bool,
pub mutation: bool,
pub mutation_add_sub: usize,
pub mutation_sub_add: usize,
pub mutation_mul_div: usize,
pub mutation_div_mul: usize,
pub boogie_poly: bool,
pub deep_pack_unpack: bool,
pub auto_trace_level: AutoTraceLevel,
pub report_severity: Severity,
pub dump_bytecode: bool,
pub dump_cfg: bool,
pub num_instances: usize,
pub sequential_task: bool,
pub check_inconsistency: bool,
pub unconditional_abort_as_inconsistency: bool,
pub for_interpretation: bool,
}
impl Default for ProverOptions {
fn default() -> Self {
Self {
generate_only: false,
native_stubs: false,
minimize_execution_trace: true,
omit_model_debug: false,
stable_test_output: false,
verify_scope: VerificationScope::All,
resource_wellformed_axiom: false,
assume_wellformed_on_access: false,
mutation: false,
mutation_add_sub: 0,
mutation_sub_add: 0,
mutation_mul_div: 0,
mutation_div_mul: 0,
boogie_poly: false,
deep_pack_unpack: false,
auto_trace_level: AutoTraceLevel::Off,
report_severity: Severity::Warning,
dump_bytecode: false,
dump_cfg: false,
num_instances: 1,
sequential_task: false,
check_inconsistency: false,
unconditional_abort_as_inconsistency: false,
for_interpretation: false,
}
}
}
impl ProverOptions {
pub fn get(env: &GlobalEnv) -> Rc<ProverOptions> {
if !env.has_extension::<ProverOptions>() {
env.set_extension(ProverOptions::default())
}
env.get_extension::<ProverOptions>().unwrap()
}
pub fn set(env: &GlobalEnv, options: ProverOptions) {
env.set_extension::<ProverOptions>(options);
}
}