split isar_step into isar_step, fix, assms; made isar_proof explicit; register fixed variables in ctxt and auto_fix terms to avoid superfluous annotations
1 (* Title: HOL/Tools/Sledgehammer/sledgehammer_proof.ML
2 Author: Jasmin Blanchette, TU Muenchen
3 Author: Steffen Juilf Smolka, TU Muenchen
5 Basic data structures for representing and basic methods
6 for dealing with Isar proof texts.
9 signature SLEDGEHAMMER_PROOF =
11 type label = string * int
12 type facts = label list * string list
14 datatype isar_qualifier = Show | Then
16 datatype fix = Fix of (string * typ) list
17 datatype assms = Assume of (label * term) list
20 Proof of fix * assms * isar_step list
23 Prove of isar_qualifier list * label * term * byline |
24 Obtain of isar_qualifier list * fix * label * term * byline
26 By_Metis of isar_proof list * facts
31 val string_for_label : label -> string
32 val fix_of_proof : isar_proof -> fix
33 val assms_of_proof : isar_proof -> assms
34 val steps_of_proof : isar_proof -> isar_step list
36 val label_of_step : isar_step -> label option
37 val byline_of_step : isar_step -> byline option
39 val add_metis_steps_top_level : isar_step list -> int -> int
40 val add_metis_steps : isar_step list -> int -> int
43 structure Sledgehammer_Proof : SLEDGEHAMMER_PROOF =
46 type label = string * int
47 type facts = label list * string list
49 datatype isar_qualifier = Show | Then
51 datatype fix = Fix of (string * typ) list
52 datatype assms = Assume of (label * term) list
55 Proof of fix * assms * isar_step list
58 Prove of isar_qualifier list * label * term * byline |
59 Obtain of isar_qualifier list * fix * label * term * byline
61 By_Metis of isar_proof list * facts
63 val no_label = ("", ~1)
64 val no_facts = ([],[])
66 fun string_for_label (s, num) = s ^ string_of_int num
68 fun fix_of_proof (Proof (fix, _, _)) = fix
69 fun assms_of_proof (Proof (_, assms, _)) = assms
70 fun steps_of_proof (Proof (_, _, steps)) = steps
71 (*fun map_steps_of_proof f (Proof (fix, assms, steps)) =
72 Proof(fix, assms, f steps)*)
74 fun label_of_step (Obtain (_, _, l, _, _)) = SOME l
75 | label_of_step (Prove (_, l, _, _)) = SOME l
76 | label_of_step _ = NONE
78 fun byline_of_step (Obtain (_, _, _, _, byline)) = SOME byline
79 | byline_of_step (Prove (_, _, _, byline)) = SOME byline
80 | byline_of_step _ = NONE
82 val add_metis_steps_top_level =
83 fold (byline_of_step #> (fn SOME (By_Metis _) => Integer.add 1 | _ => I))
85 fun add_metis_steps steps =
87 #> (fn SOME (By_Metis (subproofs, _)) =>
88 Integer.add 1 #> add_substeps subproofs
90 and add_substeps subproofs = fold (steps_of_proof #> add_metis_steps) subproofs