src/Pure/Isar/skip_proof.ML
author wenzelm
Wed Oct 01 12:18:18 2008 +0200 (2008-10-01 ago)
changeset 28446 a01de3b3fa2e
parent 28365 6249297461cb
child 28552 f8719bcc5006
permissions -rw-r--r--
renamed promise to future, tuned related interfaces;
     1 (*  Title:      Pure/Isar/skip_proof.ML
     2     ID:         $Id$
     3     Author:     Markus Wenzel, TU Muenchen
     4 
     5 Skipping proofs -- quick_and_dirty mode.
     6 *)
     7 
     8 val future_scheduler = ref false;
     9 
    10 signature SKIP_PROOF =
    11 sig
    12   val make_thm: theory -> term -> thm
    13   val cheat_tac: theory -> tactic
    14   val prove: Proof.context -> string list -> term list -> term ->
    15     ({prems: thm list, context: Proof.context} -> tactic) -> thm
    16   val prove_global: theory -> string list -> term list -> term ->
    17     ({prems: thm list, context: Proof.context} -> tactic) -> thm
    18 end;
    19 
    20 structure SkipProof: SKIP_PROOF =
    21 struct
    22 
    23 (* oracle setup *)
    24 
    25 val (_, skip_proof) = Context.>>> (Context.map_theory_result
    26   (Thm.add_oracle ("skip_proof", fn (thy, prop) =>
    27     if ! quick_and_dirty then Thm.cterm_of thy prop
    28     else error "Proof may be skipped in quick_and_dirty mode only!")));
    29 
    30 
    31 (* basic cheating *)
    32 
    33 fun make_thm thy prop = skip_proof (thy, prop);
    34 
    35 fun cheat_tac thy st =
    36   ALLGOALS (Tactic.rtac (make_thm thy (Var (("A", 0), propT)))) st;
    37 
    38 fun prove ctxt xs asms prop tac =
    39   (if ! future_scheduler then Goal.prove_future else Goal.prove) ctxt xs asms prop
    40     (fn args => fn st =>
    41       if ! quick_and_dirty
    42       then setmp quick_and_dirty true (cheat_tac (ProofContext.theory_of ctxt)) st
    43       else tac args st);
    44 
    45 fun prove_global thy xs asms prop tac =
    46   Drule.standard (prove (ProofContext.init thy) xs asms prop tac);
    47 
    48 end;