src/Pure/Isar/skip_proof.ML
author wenzelm
Thu Mar 27 15:32:15 2008 +0100 (2008-03-27 ago)
changeset 26435 bdce320cd426
parent 24502 8d5326f0098b
child 26463 9283b4185fdf
permissions -rw-r--r--
eliminated delayed theory setup
     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 signature SKIP_PROOF =
     9 sig
    10   val make_thm: theory -> term -> thm
    11   val cheat_tac: theory -> tactic
    12   val prove: Proof.context -> string list -> term list -> term ->
    13     ({prems: thm list, context: Proof.context} -> tactic) -> thm
    14 end;
    15 
    16 structure SkipProof: SKIP_PROOF =
    17 struct
    18 
    19 (* oracle setup *)
    20 
    21 exception SkipProof of term;
    22 
    23 fun skip_proof (_, SkipProof prop) =
    24   if ! quick_and_dirty then prop
    25   else error "Proof may be skipped in quick_and_dirty mode only!";
    26 
    27 val _ = Context.>> (Theory.add_oracle ("skip_proof", skip_proof));
    28 
    29 
    30 (* basic cheating *)
    31 
    32 fun make_thm thy prop =
    33   Thm.invoke_oracle_i thy "Pure.skip_proof" (thy, SkipProof 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   Goal.prove ctxt xs asms prop (fn args => fn st =>
    40     if ! quick_and_dirty
    41     then setmp quick_and_dirty true (cheat_tac (ProofContext.theory_of ctxt)) st
    42     else tac args st);
    43 
    44 end;