src/Pure/Isar/skip_proof.ML
author wenzelm
Mon Mar 20 18:48:12 2000 +0100 (2000-03-20)
changeset 8539 3cbe48a112f7
parent 6984 26d43e26ea61
child 8807 0046be1769f9
permissions -rw-r--r--
added prove_goalw_cterm;
quick_and_dirty moved here;
wenzelm@6888
     1
(*  Title:      Pure/Isar/skip_proof.ML
wenzelm@6888
     2
    ID:         $Id$
wenzelm@6888
     3
    Author:     Markus Wenzel, TU Muenchen
wenzelm@6888
     4
wenzelm@8539
     5
Skipping proofs -- quick_and_dirty mode.
wenzelm@6888
     6
*)
wenzelm@6888
     7
wenzelm@6888
     8
signature SKIP_PROOF =
wenzelm@6888
     9
sig
wenzelm@8539
    10
  val quick_and_dirty: bool ref
wenzelm@6984
    11
  val local_skip_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit)
wenzelm@6888
    12
    -> Proof.state -> Proof.state Seq.seq
wenzelm@6888
    13
  val global_skip_proof: Proof.state -> theory * {kind: string, name: string, thm: thm}
wenzelm@8539
    14
  val prove_goalw_cterm: theory -> thm list -> cterm -> (thm list -> tactic list) -> thm
wenzelm@6888
    15
  val setup: (theory -> theory) list
wenzelm@6888
    16
end;
wenzelm@6888
    17
wenzelm@6888
    18
structure SkipProof: SKIP_PROOF =
wenzelm@6888
    19
struct
wenzelm@6888
    20
wenzelm@6888
    21
wenzelm@8539
    22
(* quick_and_dirty *)
wenzelm@8539
    23
wenzelm@8539
    24
(*if true then some packages will OMIT SOME PROOFS*)
wenzelm@8539
    25
val quick_and_dirty = ref false;
wenzelm@8539
    26
wenzelm@8539
    27
wenzelm@8539
    28
(* cheat_tac *)
wenzelm@6888
    29
wenzelm@6888
    30
val skip_proofN = "skip_proof";
wenzelm@6888
    31
wenzelm@6888
    32
exception SkipProof;
wenzelm@6888
    33
val any_prop = Var (("A", 0), propT);
wenzelm@6888
    34
wenzelm@6888
    35
fun any_thm (_, SkipProof) =
wenzelm@6888
    36
  if ! quick_and_dirty then any_prop
wenzelm@6888
    37
  else error "Proofs may be skipped in quick_and_dirty mode only!";
wenzelm@6888
    38
wenzelm@6888
    39
wenzelm@8539
    40
(*too bad -- dynamic scoping of the oracle, cannot even qualify the name*)
wenzelm@8539
    41
fun cheat_tac thy st =
wenzelm@8539
    42
  ALLGOALS (Tactic.rtac (Thm.invoke_oracle thy skip_proofN (Theory.sign_of thy, SkipProof))) st;
wenzelm@6888
    43
wenzelm@6888
    44
wenzelm@8539
    45
(* "sorry" proof command *)
wenzelm@8539
    46
wenzelm@8539
    47
fun cheating ctxt = Method.METHOD (K (cheat_tac (ProofContext.theory_of ctxt)));
wenzelm@8539
    48
wenzelm@8539
    49
val local_skip_proof = Method.local_terminal_proof (Method.Basic cheating, None);
wenzelm@8539
    50
val global_skip_proof = Method.global_terminal_proof (Method.Basic cheating, None);
wenzelm@8539
    51
wenzelm@8539
    52
wenzelm@8539
    53
(* conditional prove_goalw_cterm *)
wenzelm@8539
    54
wenzelm@8539
    55
fun prove_goalw_cterm thy rews ct tacs =
wenzelm@8539
    56
  Goals.prove_goalw_cterm rews ct
wenzelm@8539
    57
    (if ! quick_and_dirty then (K [cheat_tac thy]) else tacs);
wenzelm@6888
    58
wenzelm@6888
    59
wenzelm@6888
    60
(* theory setup *)
wenzelm@6888
    61
wenzelm@6888
    62
val setup = [Theory.add_oracle (skip_proofN, any_thm)];
wenzelm@6888
    63
wenzelm@6888
    64
wenzelm@6888
    65
end;
wenzelm@8539
    66
wenzelm@8539
    67
wenzelm@8539
    68
val quick_and_dirty = SkipProof.quick_and_dirty;