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