src/Pure/Isar/skip_proof.ML
author wenzelm
Thu, 30 Nov 2006 14:17:29 +0100
changeset 21605 4e7307e229b3
parent 20289 ba7a7c56bed5
child 24502 8d5326f0098b
permissions -rw-r--r--
qualified MetaSimplifier.norm_hhf(_protect);

(*  Title:      Pure/Isar/skip_proof.ML
    ID:         $Id$
    Author:     Markus Wenzel, TU Muenchen

Skipping proofs -- quick_and_dirty mode.
*)

signature SKIP_PROOF =
sig
  val make_thm: theory -> term -> thm
  val cheat_tac: theory -> tactic
  val prove: Proof.context -> string list -> term list -> term ->
    ({prems: thm list, context: Proof.context} -> tactic) -> thm
end;

structure SkipProof: SKIP_PROOF =
struct

(* oracle setup *)

exception SkipProof of term;

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

val _ = Context.add_setup (Theory.add_oracle ("skip_proof", skip_proof));


(* basic cheating *)

fun make_thm thy prop =
  Thm.invoke_oracle_i thy "Pure.skip_proof" (thy, SkipProof prop);

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

fun prove ctxt xs asms prop tac =
  Goal.prove ctxt xs asms prop
    (if ! quick_and_dirty then (K (cheat_tac (ProofContext.theory_of ctxt))) else tac);

end;