src/Pure/Isar/skip_proof.ML
author wenzelm
Fri May 05 22:09:41 2000 +0200 (2000-05-05 ago)
changeset 8807 0046be1769f9
parent 8539 3cbe48a112f7
child 11732 139aaced13f4
permissions -rw-r--r--
GPLed;
     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 local_skip_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit)
    13     -> Proof.state -> Proof.state Seq.seq
    14   val global_skip_proof: Proof.state -> theory * {kind: string, name: string, thm: thm}
    15   val prove_goalw_cterm: theory -> thm list -> cterm -> (thm list -> tactic list) -> thm
    16   val setup: (theory -> theory) list
    17 end;
    18 
    19 structure SkipProof: SKIP_PROOF =
    20 struct
    21 
    22 
    23 (* quick_and_dirty *)
    24 
    25 (*if true then some packages will OMIT SOME PROOFS*)
    26 val quick_and_dirty = ref false;
    27 
    28 
    29 (* cheat_tac *)
    30 
    31 val skip_proofN = "skip_proof";
    32 
    33 exception SkipProof;
    34 val any_prop = Var (("A", 0), propT);
    35 
    36 fun any_thm (_, SkipProof) =
    37   if ! quick_and_dirty then any_prop
    38   else error "Proofs may be skipped in quick_and_dirty mode only!";
    39 
    40 
    41 (*too bad -- dynamic scoping of the oracle, cannot even qualify the name*)
    42 fun cheat_tac thy st =
    43   ALLGOALS (Tactic.rtac (Thm.invoke_oracle thy skip_proofN (Theory.sign_of thy, SkipProof))) st;
    44 
    45 
    46 (* "sorry" proof command *)
    47 
    48 fun cheating ctxt = Method.METHOD (K (cheat_tac (ProofContext.theory_of ctxt)));
    49 
    50 val local_skip_proof = Method.local_terminal_proof (Method.Basic cheating, None);
    51 val global_skip_proof = Method.global_terminal_proof (Method.Basic cheating, None);
    52 
    53 
    54 (* conditional prove_goalw_cterm *)
    55 
    56 fun prove_goalw_cterm thy rews ct tacs =
    57   Goals.prove_goalw_cterm rews ct
    58     (if ! quick_and_dirty then (K [cheat_tac thy]) else tacs);
    59 
    60 
    61 (* theory setup *)
    62 
    63 val setup = [Theory.add_oracle (skip_proofN, any_thm)];
    64 
    65 
    66 end;
    67 
    68 
    69 val quick_and_dirty = SkipProof.quick_and_dirty;