src/Pure/Isar/skip_proof.ML
author wenzelm
Sat Jul 08 12:54:37 2006 +0200 (2006-07-08 ago)
changeset 20049 f48c4a3a34bc
parent 18708 4b3dadb4fe33
child 20248 7916ce5bb069
permissions -rw-r--r--
Goal.prove: context;
     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: ProofContext.context ->
    13     string list -> term list -> term -> (thm list -> 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.add_setup (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
    40     (if ! quick_and_dirty then (K (cheat_tac (ProofContext.theory_of ctxt))) else tac);
    41 
    42 end;