author | wenzelm |
Fri, 12 Oct 2001 12:09:38 +0200 | |
changeset 11732 | 139aaced13f4 |
parent 8807 | 0046be1769f9 |
child 11892 | 4a8834757140 |
permissions | -rw-r--r-- |
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
1 |
(* Title: Pure/Isar/skip_proof.ML |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
2 |
ID: $Id$ |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
3 |
Author: Markus Wenzel, TU Muenchen |
8807 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
5 |
|
8539 | 6 |
Skipping proofs -- quick_and_dirty mode. |
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
7 |
*) |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
8 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
9 |
signature SKIP_PROOF = |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
10 |
sig |
8539 | 11 |
val quick_and_dirty: bool ref |
6984 | 12 |
val local_skip_proof: ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit) |
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
13 |
-> Proof.state -> Proof.state Seq.seq |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
14 |
val global_skip_proof: Proof.state -> theory * {kind: string, name: string, thm: thm} |
8539 | 15 |
val prove_goalw_cterm: theory -> thm list -> cterm -> (thm list -> tactic list) -> thm |
11732 | 16 |
val make_thm: theory -> term -> thm |
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
17 |
val setup: (theory -> theory) list |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
18 |
end; |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
19 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
20 |
structure SkipProof: SKIP_PROOF = |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
21 |
struct |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
22 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
23 |
|
8539 | 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 *) |
|
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
31 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
32 |
val skip_proofN = "skip_proof"; |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
33 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
34 |
exception SkipProof; |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
35 |
val any_prop = Var (("A", 0), propT); |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
36 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
37 |
fun any_thm (_, SkipProof) = |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
38 |
if ! quick_and_dirty then any_prop |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
39 |
else error "Proofs may be skipped in quick_and_dirty mode only!"; |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
40 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
41 |
|
8539 | 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; |
|
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
45 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
46 |
|
8539 | 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); |
|
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
60 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
61 |
|
11732 | 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 |
||
6888
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
68 |
(* theory setup *) |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
69 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
70 |
val setup = [Theory.add_oracle (skip_proofN, any_thm)]; |
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
71 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
72 |
|
d0c68ebdabc5
skip_proof feature 'sorry' (for quick_and_dirty mode only);
wenzelm
parents:
diff
changeset
|
73 |
end; |
8539 | 74 |
|
75 |
||
76 |
val quick_and_dirty = SkipProof.quick_and_dirty; |