src/Pure/Isar/skip_proof.ML
author wenzelm
Mon, 22 Oct 2001 18:03:49 +0200
changeset 11892 4a8834757140
parent 11732 139aaced13f4
child 11972 15da572c3c27
permissions -rw-r--r--
moved prove_goalw_cterm to goals.ML; cleaned up;

(*  Title:      Pure/Isar/skip_proof.ML
    ID:         $Id$
    Author:     Markus Wenzel, TU Muenchen
    License:    GPL (GNU GENERAL PUBLIC LICENSE)

Skipping proofs -- quick_and_dirty mode.
*)

signature SKIP_PROOF =
sig
  val quick_and_dirty: bool ref
  val make_thm: theory -> term -> thm
  val cheat_tac: theory -> tactic
  val local_skip_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit)
    -> Proof.state -> Proof.state Seq.seq
  val global_skip_proof: Proof.state -> theory * {kind: string, name: string, thm: thm}
  val setup: (theory -> theory) list
end;

structure SkipProof: SKIP_PROOF =
struct


(* quick_and_dirty *)

(*if true then some packages will OMIT SOME PROOFS*)
val quick_and_dirty = ref false;


(* oracle setup *)

val skip_proofN = "skip_proof";

exception SkipProof of term;

fun skip_proof (_, SkipProof t) =
  if ! quick_and_dirty then t
  else error "Proofs may be skipped in quick_and_dirty mode only!";

val setup = [Theory.add_oracle (skip_proofN, skip_proof)];


(* make_thm and cheat_tac *)

fun make_thm thy t =
  (*dynamic scoping of the oracle, cannot even qualify the name due to Pure/CPure!*)
  Thm.invoke_oracle thy skip_proofN (Theory.sign_of thy, SkipProof t);

fun cheat_tac thy st =
  ALLGOALS (Tactic.rtac (make_thm thy (Var (("A", 0), propT)))) st;


(* "sorry" proof command *)

fun cheating ctxt = Method.METHOD (K (cheat_tac (ProofContext.theory_of ctxt)));

val local_skip_proof = Method.local_terminal_proof (Method.Basic cheating, None);
val global_skip_proof = Method.global_terminal_proof (Method.Basic cheating, None);

end;


val quick_and_dirty = SkipProof.quick_and_dirty;