src/Pure/Isar/skip_proof.ML
author wenzelm
Mon Oct 22 18:03:49 2001 +0200 (2001-10-22 ago)
changeset 11892 4a8834757140
parent 11732 139aaced13f4
child 11972 15da572c3c27
permissions -rw-r--r--
moved prove_goalw_cterm to goals.ML;
cleaned up;
     1 (*  Title:      Pure/Isar/skip_proof.ML
     2     ID:         $Id$
     3     Author:     Markus Wenzel, TU Muenchen
     4     License:    GPL (GNU GENERAL PUBLIC LICENSE)
     5 
     6 Skipping proofs -- quick_and_dirty mode.
     7 *)
     8 
     9 signature SKIP_PROOF =
    10 sig
    11   val quick_and_dirty: bool ref
    12   val make_thm: theory -> term -> thm
    13   val cheat_tac: theory -> tactic
    14   val local_skip_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit)
    15     -> Proof.state -> Proof.state Seq.seq
    16   val global_skip_proof: Proof.state -> theory * {kind: string, name: string, thm: thm}
    17   val setup: (theory -> theory) list
    18 end;
    19 
    20 structure SkipProof: SKIP_PROOF =
    21 struct
    22 
    23 
    24 (* quick_and_dirty *)
    25 
    26 (*if true then some packages will OMIT SOME PROOFS*)
    27 val quick_and_dirty = ref false;
    28 
    29 
    30 (* oracle setup *)
    31 
    32 val skip_proofN = "skip_proof";
    33 
    34 exception SkipProof of term;
    35 
    36 fun skip_proof (_, SkipProof t) =
    37   if ! quick_and_dirty then t
    38   else error "Proofs may be skipped in quick_and_dirty mode only!";
    39 
    40 val setup = [Theory.add_oracle (skip_proofN, skip_proof)];
    41 
    42 
    43 (* make_thm and cheat_tac *)
    44 
    45 fun make_thm thy t =
    46   (*dynamic scoping of the oracle, cannot even qualify the name due to Pure/CPure!*)
    47   Thm.invoke_oracle thy skip_proofN (Theory.sign_of thy, SkipProof t);
    48 
    49 fun cheat_tac thy st =
    50   ALLGOALS (Tactic.rtac (make_thm thy (Var (("A", 0), propT)))) st;
    51 
    52 
    53 (* "sorry" proof command *)
    54 
    55 fun cheating ctxt = Method.METHOD (K (cheat_tac (ProofContext.theory_of ctxt)));
    56 
    57 val local_skip_proof = Method.local_terminal_proof (Method.Basic cheating, None);
    58 val global_skip_proof = Method.global_terminal_proof (Method.Basic cheating, None);
    59 
    60 end;
    61 
    62 
    63 val quick_and_dirty = SkipProof.quick_and_dirty;