src/HOL/Boogie/Tools/boogie_commands.ML
changeset 35864 d82c0dd51794
parent 35356 5c937073e1d5
child 36323 655e2d74de3a
equal deleted inserted replaced
35863:d4218a55cf20 35864:d82c0dd51794
    61     Goal.prove ctxt [] [] goal (fn {context, ...} => HEADGOAL (
    61     Goal.prove ctxt [] [] goal (fn {context, ...} => HEADGOAL (
    62       Boogie_Tactics.split_tac
    62       Boogie_Tactics.split_tac
    63       THEN' Boogie_Tactics.drop_assert_at_tac
    63       THEN' Boogie_Tactics.drop_assert_at_tac
    64       THEN' SUBPROOF (fn _ => Tactic.rtac thm 1) context))
    64       THEN' SUBPROOF (fn _ => Tactic.rtac thm 1) context))
    65 in
    65 in
    66 fun boogie_vc (vc_name, vc_opts) lthy =
    66 fun boogie_vc (vc_name, vc_opts) thy =
    67   let
    67   let
    68     val thy = ProofContext.theory_of lthy
       
    69     val vc = get_vc thy vc_name
    68     val vc = get_vc thy vc_name
    70 
    69 
    71     fun extract vc l =
    70     fun extract vc l =
    72       (case Boogie_VCs.extract vc l of
    71       (case Boogie_VCs.extract vc l of
    73         SOME vc' => vc'
    72         SOME vc' => vc'
    90       (case vc_opts of
    89       (case vc_opts of
    91          VC_Single _ => (single_prep (hd ts), single_prove (hd ts))
    90          VC_Single _ => (single_prep (hd ts), single_prove (hd ts))
    92       | _ => (pair ts, K I))
    91       | _ => (pair ts, K I))
    93 
    92 
    94     val discharge = fold (Boogie_VCs.discharge o pair vc_name)
    93     val discharge = fold (Boogie_VCs.discharge o pair vc_name)
    95     fun after_qed [thms] = Local_Theory.theory (discharge (vcs ~~ thms))
    94     fun after_qed [thms] = ProofContext.theory (discharge (vcs ~~ thms))
    96       | after_qed _ = I
    95       | after_qed _ = I
    97   in
    96   in
    98     lthy
    97     ProofContext.init thy
    99     |> fold Variable.auto_fixes ts
    98     |> fold Variable.auto_fixes ts
   100     |> (fn lthy1 => lthy1
    99     |> (fn ctxt1 => ctxt1
   101     |> prepare
   100     |> prepare
   102     |-> (fn us => fn lthy2 => lthy2
   101     |-> (fn us => fn ctxt2 => ctxt2
   103     |> Proof.theorem_i NONE (fn thmss => fn ctxt =>
   102     |> Proof.theorem_i NONE (fn thmss => fn ctxt =>
   104          let val export = map (finish lthy1) o ProofContext.export ctxt lthy2
   103          let val export = map (finish ctxt1) o ProofContext.export ctxt ctxt2
   105          in after_qed (map export thmss) ctxt end) [map (rpair []) us]))
   104          in after_qed (map export thmss) ctxt end) [map (rpair []) us]))
   106   end
   105   end
   107 end
   106 end
   108 
   107 
   109 fun write_list head =
   108 fun write_list head =
   298 val _ =
   297 val _ =
   299   OuterSyntax.command "boogie_vc"
   298   OuterSyntax.command "boogie_vc"
   300     "Enter into proof mode for a specific verification condition."
   299     "Enter into proof mode for a specific verification condition."
   301     OuterKeyword.thy_goal
   300     OuterKeyword.thy_goal
   302     (vc_name -- vc_opts >> (fn args =>
   301     (vc_name -- vc_opts >> (fn args =>
   303       (Toplevel.print o Toplevel.local_theory_to_proof NONE (boogie_vc args))))
   302       (Toplevel.print o Toplevel.theory_to_proof (boogie_vc args))))
   304 
   303 
   305 
   304 
   306 val quick_timeout = 5
   305 val quick_timeout = 5
   307 val default_timeout = 20
   306 val default_timeout = 20
   308 
   307