196 |
196 |
197 fun parse_raw_proof_step (p : SMTLIB.tree) : raw_veriT_node = |
197 fun parse_raw_proof_step (p : SMTLIB.tree) : raw_veriT_node = |
198 let |
198 let |
199 fun rotate_pair (a, (b, c)) = ((a, b), c) |
199 fun rotate_pair (a, (b, c)) = ((a, b), c) |
200 fun get_id (SMTLIB.S [SMTLIB.Sym "set", SMTLIB.Sym id, SMTLIB.S l]) = (id, l) |
200 fun get_id (SMTLIB.S [SMTLIB.Sym "set", SMTLIB.Sym id, SMTLIB.S l]) = (id, l) |
201 | get_id t = raise Fail ("unrecognized VeriT proof " ^ @{make_string} t) |
201 | get_id t = raise Fail ("unrecognized VeriT proof " ^ \<^make_string> t) |
202 fun parse_source (SMTLIB.Key "clauses" :: SMTLIB.S source ::l) = |
202 fun parse_source (SMTLIB.Key "clauses" :: SMTLIB.S source ::l) = |
203 (SOME (map (fn (SMTLIB.Sym id) => id) source), l) |
203 (SOME (map (fn (SMTLIB.Sym id) => id) source), l) |
204 | parse_source l = (NONE, l) |
204 | parse_source l = (NONE, l) |
205 fun parse_subproof rule args id_of_father_step ((subproof_step as SMTLIB.S (SMTLIB.Sym "set" :: _)) :: l) = |
205 fun parse_subproof rule args id_of_father_step ((subproof_step as SMTLIB.S (SMTLIB.Sym "set" :: _)) :: l) = |
206 let |
206 let |
284 |
284 |
285 (* postprocess conclusion *) |
285 (* postprocess conclusion *) |
286 val new_global_bounds = global_bound_vars_by_rule rule args |
286 val new_global_bounds = global_bound_vars_by_rule rule args |
287 val concl = SMTLIB_Isar.unskolemize_names ctxt concl |
287 val concl = SMTLIB_Isar.unskolemize_names ctxt concl |
288 |
288 |
289 val _ = (SMT_Config.veriT_msg ctxt) (fn () => @{print} ("id =", id, "concl =", concl)) |
289 val _ = (SMT_Config.veriT_msg ctxt) (fn () => \<^print> ("id =", id, "concl =", concl)) |
290 val _ = (SMT_Config.veriT_msg ctxt) (fn () => @{print} ("id =", id, "cx' =", cx', |
290 val _ = (SMT_Config.veriT_msg ctxt) (fn () => \<^print> ("id =", id, "cx' =", cx', |
291 "bound_vars =", bound_vars)) |
291 "bound_vars =", bound_vars)) |
292 val bound_vars = filter_out (member ((op =)) new_global_bounds) bound_vars |
292 val bound_vars = filter_out (member ((op =)) new_global_bounds) bound_vars |
293 val bound_tvars = |
293 val bound_tvars = |
294 map (fn s => (s, the (find_type_in_formula concl s))) bound_vars |
294 map (fn s => (s, the (find_type_in_formula concl s))) bound_vars |
295 val subproof_cx = add_bound_variables_to_ctxt concl bound_vars cx |
295 val subproof_cx = add_bound_variables_to_ctxt concl bound_vars cx |
375 let |
375 let |
376 fun linearize (VeriT_Replay_Node {id = id, rule = rule, args = _, prems = prems, |
376 fun linearize (VeriT_Replay_Node {id = id, rule = rule, args = _, prems = prems, |
377 proof_ctxt = proof_ctxt, concl = concl, bounds = bounds, subproof = (_, _, subproof)}) = |
377 proof_ctxt = proof_ctxt, concl = concl, bounds = bounds, subproof = (_, _, subproof)}) = |
378 let |
378 let |
379 fun mk_prop_of_term concl = |
379 fun mk_prop_of_term concl = |
380 concl |> fastype_of concl = @{typ bool} ? curry (op $) @{term Trueprop} |
380 concl |> fastype_of concl = \<^typ>\<open>bool\<close> ? curry (op $) \<^term>\<open>Trueprop\<close> |
381 fun remove_assumption_id assumption_id prems = |
381 fun remove_assumption_id assumption_id prems = |
382 filter_out (curry (op =) assumption_id) prems |
382 filter_out (curry (op =) assumption_id) prems |
383 fun inline_assumption assumption assumption_id |
383 fun inline_assumption assumption assumption_id |
384 (VeriT_Node {id, rule, prems, proof_ctxt, concl, bounds}) = |
384 (VeriT_Node {id, rule, prems, proof_ctxt, concl, bounds}) = |
385 mk_node id rule (remove_assumption_id assumption_id prems) proof_ctxt |
385 mk_node id rule (remove_assumption_id assumption_id prems) proof_ctxt |