src/Pure/Isar/skip_proof.ML
changeset 32970 fbd2bb2489a8
parent 32966 5b21661fe618
child 35021 c839a4c670c6
equal deleted inserted replaced
32969:15489e162b21 32970:fbd2bb2489a8
     1 (*  Title:      Pure/Isar/skip_proof.ML
     1 (*  Title:      Pure/Isar/skip_proof.ML
     2     Author:     Markus Wenzel, TU Muenchen
     2     Author:     Markus Wenzel, TU Muenchen
     3 
     3 
     4 Skipping proofs -- quick_and_dirty mode.
     4 Skipping proofs -- via oracle (in quick and dirty mode) or by forking
       
     5 (parallel mode).
     5 *)
     6 *)
     6 
     7 
     7 signature SKIP_PROOF =
     8 signature SKIP_PROOF =
     8 sig
     9 sig
     9   val make_thm: theory -> term -> thm
    10   val make_thm: theory -> term -> thm
    12     ({prems: thm list, context: Proof.context} -> tactic) -> thm
    13     ({prems: thm list, context: Proof.context} -> tactic) -> thm
    13   val prove_global: theory -> string list -> term list -> term ->
    14   val prove_global: theory -> string list -> term list -> term ->
    14     ({prems: thm list, context: Proof.context} -> tactic) -> thm
    15     ({prems: thm list, context: Proof.context} -> tactic) -> thm
    15 end;
    16 end;
    16 
    17 
    17 structure SkipProof: SKIP_PROOF =
    18 structure Skip_Proof: SKIP_PROOF =
    18 struct
    19 struct
    19 
    20 
    20 (* oracle setup *)
    21 (* oracle setup *)
    21 
    22 
    22 val (_, skip_proof) = Context.>>> (Context.map_theory_result
    23 val (_, skip_proof) = Context.>>> (Context.map_theory_result
    23   (Thm.add_oracle (Binding.name "skip_proof", fn (thy, prop) =>
    24   (Thm.add_oracle (Binding.name "skip_proof", fn (thy, prop) => Thm.cterm_of thy prop)));
    24     if ! quick_and_dirty then Thm.cterm_of thy prop
       
    25     else error "Proof may be skipped in quick_and_dirty mode only!")));
       
    26 
    25 
    27 
    26 
    28 (* basic cheating *)
    27 (* basic cheating *)
    29 
    28 
    30 fun make_thm thy prop = skip_proof (thy, prop);
    29 fun make_thm thy prop = skip_proof (thy, prop);
    34 
    33 
    35 fun prove ctxt xs asms prop tac =
    34 fun prove ctxt xs asms prop tac =
    36   (if Goal.future_enabled () then Goal.prove_future else Goal.prove) ctxt xs asms prop
    35   (if Goal.future_enabled () then Goal.prove_future else Goal.prove) ctxt xs asms prop
    37     (fn args => fn st =>
    36     (fn args => fn st =>
    38       if ! quick_and_dirty
    37       if ! quick_and_dirty
    39       then setmp_CRITICAL quick_and_dirty true (cheat_tac (ProofContext.theory_of ctxt)) st
    38       then cheat_tac (ProofContext.theory_of ctxt) st
    40       else tac args st);
    39       else tac args st);
    41 
    40 
    42 fun prove_global thy xs asms prop tac =
    41 fun prove_global thy xs asms prop tac =
    43   Drule.standard (prove (ProofContext.init thy) xs asms prop tac);
    42   Drule.standard (prove (ProofContext.init thy) xs asms prop tac);
    44 
    43