104 case atom_name_opt of |
104 case atom_name_opt of |
105 NONE => all_tac |
105 NONE => all_tac |
106 | SOME atom_name => generate_fresh_tac ctxt atom_name |
106 | SOME atom_name => generate_fresh_tac ctxt atom_name |
107 end) 1; |
107 end) 1; |
108 |
108 |
109 (* Two substitution tactics which looks for the innermost occurence in |
109 (* Two substitution tactics which looks for the innermost occurrence in |
110 one assumption or in the conclusion *) |
110 one assumption or in the conclusion *) |
111 |
111 |
112 val search_fun = curry (Seq.flat o uncurry EqSubst.searchf_bt_unify_valid); |
112 val search_fun = curry (Seq.flat o uncurry EqSubst.searchf_bt_unify_valid); |
113 val search_fun_asm = EqSubst.skip_first_asm_occs_search EqSubst.searchf_bt_unify_valid; |
113 val search_fun_asm = EqSubst.skip_first_asm_occs_search EqSubst.searchf_bt_unify_valid; |
114 |
114 |
115 fun subst_inner_tac ctxt = EqSubst.eqsubst_tac' ctxt search_fun; |
115 fun subst_inner_tac ctxt = EqSubst.eqsubst_tac' ctxt search_fun; |
116 fun subst_inner_asm_tac_aux i ctxt = EqSubst.eqsubst_asm_tac' ctxt search_fun_asm i; |
116 fun subst_inner_asm_tac_aux i ctxt = EqSubst.eqsubst_asm_tac' ctxt search_fun_asm i; |
117 |
117 |
118 (* A tactic to substitute in the first assumption |
118 (* A tactic to substitute in the first assumption |
119 which contains an occurence. *) |
119 which contains an occurrence. *) |
120 |
120 |
121 fun subst_inner_asm_tac ctxt th = |
121 fun subst_inner_asm_tac ctxt th = |
122 curry (curry (FIRST' (map uncurry (map uncurry (map subst_inner_asm_tac_aux |
122 curry (curry (FIRST' (map uncurry (map uncurry (map subst_inner_asm_tac_aux |
123 (1 upto Thm.nprems_of th)))))) ctxt th; |
123 (1 upto Thm.nprems_of th)))))) ctxt th; |
124 |
124 |