equal
deleted
inserted
replaced
16 val init: cterm -> thm |
16 val init: cterm -> thm |
17 val protect: thm -> thm |
17 val protect: thm -> thm |
18 val conclude: thm -> thm |
18 val conclude: thm -> thm |
19 val finish: thm -> thm |
19 val finish: thm -> thm |
20 val norm_hhf: thm -> thm |
20 val norm_hhf: thm -> thm |
21 val norm_hhf': thm -> thm |
21 val norm_hhf_protected: thm -> thm |
22 val compose_hhf: thm -> int -> thm -> thm Seq.seq |
22 val compose_hhf: thm -> int -> thm -> thm Seq.seq |
23 val compose_hhf_tac: thm -> int -> tactic |
23 val compose_hhf_tac: thm -> int -> tactic |
24 val comp_hhf: thm -> thm -> thm |
24 val comp_hhf: thm -> thm -> thm |
25 val prove_multi: theory -> string list -> term list -> term list -> |
25 val prove_multi: theory -> string list -> term list -> term list -> |
26 (thm list -> tactic) -> thm list |
26 (thm list -> tactic) -> thm list |
71 |
71 |
72 |
72 |
73 |
73 |
74 (** results **) |
74 (** results **) |
75 |
75 |
76 (* HHF normal form *) |
76 (* HHF normal form: !! before ==>, outermost !! generalized *) |
77 |
77 |
78 val norm_hhf_ss = |
78 local |
|
79 |
|
80 fun gen_norm_hhf ss = |
|
81 (not o Drule.is_norm_hhf o Thm.prop_of) ? |
|
82 Drule.fconv_rule (MetaSimplifier.rewrite_cterm (true, false, false) (K (K NONE)) ss) |
|
83 #> Thm.adjust_maxidx_thm |
|
84 #> Drule.gen_all; |
|
85 |
|
86 val ss = |
79 MetaSimplifier.theory_context ProtoPure.thy MetaSimplifier.empty_ss |
87 MetaSimplifier.theory_context ProtoPure.thy MetaSimplifier.empty_ss |
80 addsimps [Drule.norm_hhf_eq]; |
88 addsimps [Drule.norm_hhf_eq]; |
81 |
89 |
82 val norm_hhf_ss' = norm_hhf_ss addeqcongs [Drule.protect_cong]; |
90 in |
83 |
91 |
84 fun gen_norm_hhf protected = |
92 val norm_hhf = gen_norm_hhf ss; |
85 (not o Drule.is_norm_hhf o Thm.prop_of) ? |
93 val norm_hhf_protected = gen_norm_hhf (ss addeqcongs [Drule.protect_cong]); |
86 Drule.fconv_rule (MetaSimplifier.rewrite_cterm (true, false, false) (K (K NONE)) |
|
87 (if protected then norm_hhf_ss else norm_hhf_ss')) |
|
88 #> Thm.adjust_maxidx_thm |
|
89 #> Drule.gen_all; |
|
90 |
94 |
91 val norm_hhf = gen_norm_hhf true; |
95 end; |
92 val norm_hhf' = gen_norm_hhf false; |
|
93 |
96 |
94 |
97 |
95 (* composition of normal results *) |
98 (* composition of normal results *) |
96 |
99 |
97 fun compose_hhf tha i thb = |
100 fun compose_hhf tha i thb = |
169 |
172 |
170 (*Tactical for restricting the effect of a tactic to subgoal i. Works |
173 (*Tactical for restricting the effect of a tactic to subgoal i. Works |
171 by making a new state from subgoal i, applying tac to it, and |
174 by making a new state from subgoal i, applying tac to it, and |
172 composing the resulting thm with the original state.*) |
175 composing the resulting thm with the original state.*) |
173 |
176 |
|
177 local |
|
178 |
174 fun SELECT tac i st = |
179 fun SELECT tac i st = |
175 init (Thm.adjust_maxidx (Thm.cprem_of st i)) |
180 init (Thm.adjust_maxidx (Thm.cprem_of st i)) |
176 |> tac |
181 |> tac |
177 |> Seq.maps (fn st' => Thm.bicompose false (false, conclude st', Thm.nprems_of st') i st); |
182 |> Seq.maps (fn st' => Thm.bicompose false (false, conclude st', Thm.nprems_of st') i st); |
|
183 |
|
184 in |
178 |
185 |
179 fun SELECT_GOAL tac i st = |
186 fun SELECT_GOAL tac i st = |
180 let val n = Thm.nprems_of st in |
187 let val n = Thm.nprems_of st in |
181 if 1 <= i andalso i <= n then |
188 if 1 <= i andalso i <= n then |
182 if n = 1 then tac st else SELECT tac i st |
189 if n = 1 then tac st else SELECT tac i st |
183 else Seq.empty |
190 else Seq.empty |
184 end; |
191 end; |
185 |
192 |
186 end; |
193 end; |
187 |
194 |
|
195 end; |
|
196 |
188 structure BasicGoal: BASIC_GOAL = Goal; |
197 structure BasicGoal: BASIC_GOAL = Goal; |
189 open BasicGoal; |
198 open BasicGoal; |