src/Pure/Isar/skip_proof.ML
author wenzelm
Fri Oct 12 12:09:38 2001 +0200 (2001-10-12 ago)
changeset 11732 139aaced13f4
parent 8807 0046be1769f9
child 11892 4a8834757140
permissions -rw-r--r--
added make_thm (sort-of);
     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 make_thm: theory -> term -> 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 (* cheat_tac *)
    31 
    32 val skip_proofN = "skip_proof";
    33 
    34 exception SkipProof;
    35 val any_prop = Var (("A", 0), propT);
    36 
    37 fun any_thm (_, SkipProof) =
    38   if ! quick_and_dirty then any_prop
    39   else error "Proofs may be skipped in quick_and_dirty mode only!";
    40 
    41 
    42 (*too bad -- dynamic scoping of the oracle, cannot even qualify the name*)
    43 fun cheat_tac thy st =
    44   ALLGOALS (Tactic.rtac (Thm.invoke_oracle thy skip_proofN (Theory.sign_of thy, SkipProof))) st;
    45 
    46 
    47 (* "sorry" proof command *)
    48 
    49 fun cheating ctxt = Method.METHOD (K (cheat_tac (ProofContext.theory_of ctxt)));
    50 
    51 val local_skip_proof = Method.local_terminal_proof (Method.Basic cheating, None);
    52 val global_skip_proof = Method.global_terminal_proof (Method.Basic cheating, None);
    53 
    54 
    55 (* conditional prove_goalw_cterm *)
    56 
    57 fun prove_goalw_cterm thy rews ct tacs =
    58   Goals.prove_goalw_cterm rews ct
    59     (if ! quick_and_dirty then (K [cheat_tac thy]) else tacs);
    60 
    61 
    62 (* make_thm *)
    63 
    64 fun make_thm thy t =
    65   prove_goalw_cterm thy [] (Thm.cterm_of (Theory.sign_of thy) t) (K []);
    66 
    67 
    68 (* theory setup *)
    69 
    70 val setup = [Theory.add_oracle (skip_proofN, any_thm)];
    71 
    72 
    73 end;
    74 
    75 
    76 val quick_and_dirty = SkipProof.quick_and_dirty;