107 fun wrp s ts = wr1 (":" ^ s ^ "{") #> ins "," wre ts #> wr1 "}" |
107 fun wrp s ts = wr1 (":" ^ s ^ "{") #> ins "," wre ts #> wr1 "}" |
108 fun wr_pat (T.SPat ts) = wrp "pat" ts |
108 fun wr_pat (T.SPat ts) = wrp "pat" ts |
109 | wr_pat (T.SNoPat ts) = wrp "nopat" ts |
109 | wr_pat (T.SNoPat ts) = wrp "nopat" ts |
110 in par (wr_quant q #> fold wr_var vs #> wre b #> fold wr_pat ps) end) |
110 in par (wr_quant q #> fold wr_var vs #> wre b #> fold wr_pat ps) end) |
111 |
111 |
112 fun serialize attributes (T.Sign {typs, funs, preds}) ts stream = |
112 fun serialize attributes ({typs, funs, preds} : T.sign) ts stream = |
113 let |
113 let |
114 fun wr_decl (n, Ts) = wr_line (sep (par (wr n #> fold wr1 Ts))) |
114 fun wr_decl (n, Ts) = wr_line (sep (par (wr n #> fold wr1 Ts))) |
115 in |
115 in |
116 stream |
116 stream |
117 |> wr_line (wr "(benchmark Isabelle") |
117 |> wr_line (wr "(benchmark Isabelle") |
133 end |
133 end |
134 |
134 |
135 |
135 |
136 (* SMT solver interface using the SMT-LIB input format *) |
136 (* SMT solver interface using the SMT-LIB input format *) |
137 |
137 |
138 val basic_builtins = T.Builtins { |
138 val basic_builtins = { |
139 builtin_typ = builtin_typ, |
139 builtin_typ = builtin_typ, |
140 builtin_num = builtin_num, |
140 builtin_num = builtin_num, |
141 builtin_fun = (fn true => builtin_funcs | false => builtin_preds) } |
141 builtin_fun = (fn true => builtin_funcs | false => builtin_preds) } |
142 |
142 |
143 val default_attributes = [":logic AUFLIRA", ":status unknown"] |
143 val default_attributes = [":logic AUFLIRA", ":status unknown"] |
144 |
144 |
145 fun gen_interface builtins attributes = SMT_Solver.Interface { |
145 fun gen_interface builtins attributes = { |
146 normalize = [ |
146 normalize = [ |
147 SMT_Normalize.RewriteTrivialLets, |
147 SMT_Normalize.RewriteTrivialLets, |
148 SMT_Normalize.RewriteNegativeNumerals, |
148 SMT_Normalize.RewriteNegativeNumerals, |
149 SMT_Normalize.RewriteNaturalNumbers, |
149 SMT_Normalize.RewriteNaturalNumbers, |
150 SMT_Normalize.AddAbsMinMaxRules, |
150 SMT_Normalize.AddAbsMinMaxRules, |
151 SMT_Normalize.AddPairRules, |
151 SMT_Normalize.AddPairRules, |
152 SMT_Normalize.AddFunUpdRules ], |
152 SMT_Normalize.AddFunUpdRules ], |
153 translate = T.Config { |
153 translate = { |
154 strict = true, |
154 strict = true, |
155 prefixes = T.Prefixes { |
155 prefixes = { |
156 var_prefix = "x", |
156 var_prefix = "x", |
157 typ_prefix = "T", |
157 typ_prefix = "T", |
158 fun_prefix = "uf_", |
158 fun_prefix = "uf_", |
159 pred_prefix = "up_" }, |
159 pred_prefix = "up_" }, |
160 markers = T.Markers { |
160 markers = { |
161 term_marker = term_marker, |
161 term_marker = term_marker, |
162 formula_marker = formula_marker }, |
162 formula_marker = formula_marker }, |
163 builtins = builtins, |
163 builtins = builtins, |
164 serialize = serialize attributes }} |
164 serialize = serialize attributes }} |
165 |
165 |