equal
deleted
inserted
replaced
59 (@{term "op <= :: real => _"}, "<=") ] |
59 (@{term "op <= :: real => _"}, "<=") ] |
60 |
60 |
61 |
61 |
62 (* serialization *) |
62 (* serialization *) |
63 |
63 |
64 fun wr s stream = (TextIO.output (stream, s); stream) |
64 val wr = Buffer.add |
65 fun wr_line f = f #> wr "\n" |
65 fun wr_line f = f #> wr "\n" |
66 |
66 |
67 fun sep f = wr " " #> f |
67 fun sep f = wr " " #> f |
68 fun par f = sep (wr "(" #> f #> wr ")") |
68 fun par f = sep (wr "(" #> f #> wr ")") |
69 |
69 |
116 fun wrp s ts = wr1 (":" ^ s ^ " {") #> fold wre ts #> wr1 "}" |
116 fun wrp s ts = wr1 (":" ^ s ^ " {") #> fold wre ts #> wr1 "}" |
117 fun wr_pat (T.SPat ts) = wrp "pat" ts |
117 fun wr_pat (T.SPat ts) = wrp "pat" ts |
118 | wr_pat (T.SNoPat ts) = wrp "nopat" ts |
118 | wr_pat (T.SNoPat ts) = wrp "nopat" ts |
119 in par (wr_quant q #> fold wr_var vs #> wre b #> fold wr_pat ps) end) |
119 in par (wr_quant q #> fold wr_var vs #> wre b #> fold wr_pat ps) end) |
120 |
120 |
121 fun serialize attributes comments ({typs, funs, preds} : T.sign) ts stream = |
121 fun serialize attributes comments ({typs, funs, preds} : T.sign) ts = |
122 let |
122 let fun wr_decl (n, Ts) = wr_line (sep (par (wr n #> fold wr1 Ts))) |
123 fun wr_decl (n, Ts) = wr_line (sep (par (wr n #> fold wr1 Ts))) |
|
124 in |
123 in |
125 stream |
124 Buffer.empty |
126 |> wr_line (wr "(benchmark Isabelle") |
125 |> wr_line (wr "(benchmark Isabelle") |
127 |> wr_line (wr ":status unknown") |
126 |> wr_line (wr ":status unknown") |
128 |> fold (wr_line o wr) attributes |
127 |> fold (wr_line o wr) attributes |
129 |> length typs > 0 ? |
128 |> length typs > 0 ? |
130 wr_line (wr ":extrasorts" #> par (fold wr1 typs)) |
129 wr_line (wr ":extrasorts" #> par (fold wr1 typs)) |
138 wr_line (wr " )")) |
137 wr_line (wr " )")) |
139 |> fold (fn t => wr ":assumption" #> wr_line (wr_expr false [] t)) ts |
138 |> fold (fn t => wr ":assumption" #> wr_line (wr_expr false [] t)) ts |
140 |> wr_line (wr ":formula true") |
139 |> wr_line (wr ":formula true") |
141 |> wr_line (wr ")") |
140 |> wr_line (wr ")") |
142 |> fold (fn comment => wr_line (wr ("; " ^ comment))) comments |
141 |> fold (fn comment => wr_line (wr ("; " ^ comment))) comments |
143 |> K () |
142 |> Buffer.content |
144 end |
143 end |
145 |
144 |
146 |
145 |
147 (* SMT solver interface using the SMT-LIB input format *) |
146 (* SMT solver interface using the SMT-LIB input format *) |
148 |
147 |