src/Pure/Isar/skip_proof.ML
author wenzelm
Mon Nov 19 23:37:01 2001 +0100 (2001-11-19 ago)
changeset 12244 179f142ffb03
parent 12148 a57873aec3bf
child 12318 72348ff7d4a0
permissions -rw-r--r--
improved treatment of common result name;
     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 prove: theory -> string list -> term list -> term -> (thm list -> tactic) -> thm
    15   val local_skip_proof: (Proof.context -> string * (string * thm list) list -> unit) *
    16     (Proof.context -> thm -> unit) -> Proof.state -> Proof.state Seq.seq
    17   val global_skip_proof: Proof.state -> theory * ((string * string) * (string * thm list) list)
    18   val setup: (theory -> theory) list
    19 end;
    20 
    21 structure SkipProof: SKIP_PROOF =
    22 struct
    23 
    24 
    25 (* quick_and_dirty *)
    26 
    27 (*if true then some packages will OMIT SOME PROOFS*)
    28 val quick_and_dirty = ref false;
    29 
    30 
    31 (* oracle setup *)
    32 
    33 val skip_proofN = "skip_proof";
    34 
    35 exception SkipProof of term;
    36 
    37 fun skip_proof (_, SkipProof t) =
    38   if ! quick_and_dirty then t
    39   else error "Proofs may be skipped in quick_and_dirty mode only!";
    40 
    41 val setup = [Theory.add_oracle (skip_proofN, skip_proof)];
    42 
    43 
    44 (* basic cheating *)
    45 
    46 fun make_thm thy t =
    47   (*dynamic scoping of the oracle, cannot even qualify the name due to Pure/CPure!*)
    48   Thm.invoke_oracle thy skip_proofN (Theory.sign_of thy, SkipProof t);
    49 
    50 fun cheat_tac thy st =
    51   ALLGOALS (Tactic.rtac (make_thm thy (Var (("A", 0), propT)))) st;
    52 
    53 fun prove thy xs asms prop tac =
    54   Tactic.prove (Theory.sign_of thy) xs asms prop
    55     (if ! quick_and_dirty then (K (cheat_tac thy)) else tac);
    56 
    57 
    58 (* "sorry" proof command *)
    59 
    60 fun cheating ctxt = Method.METHOD (K (cheat_tac (ProofContext.theory_of ctxt)));
    61 
    62 val local_skip_proof = Method.local_terminal_proof (Method.Basic cheating, None);
    63 val global_skip_proof = Method.global_terminal_proof (Method.Basic cheating, None);
    64 
    65 end;
    66 
    67 
    68 val quick_and_dirty = SkipProof.quick_and_dirty;