equal
deleted
inserted
replaced
38 val unfold_lets = @{thms Let_def[abs_def] split_beta} |
38 val unfold_lets = @{thms Let_def[abs_def] split_beta} |
39 |
39 |
40 fun exhaust_inst_as_projs ctxt frees thm = |
40 fun exhaust_inst_as_projs ctxt frees thm = |
41 let |
41 let |
42 val num_frees = length frees; |
42 val num_frees = length frees; |
43 val fs = Term.add_vars (prop_of thm) [] |> filter (can dest_funT o snd); |
43 val fs = Term.add_vars (Thm.prop_of thm) [] |> filter (can dest_funT o snd); |
44 fun find s = find_index (curry (op =) s) frees; |
44 fun find s = find_index (curry (op =) s) frees; |
45 fun mk_cfp (f as ((s, _), T)) = |
45 fun mk_cfp (f as ((s, _), T)) = |
46 (Proof_Context.cterm_of ctxt (Var f), Proof_Context.cterm_of ctxt (mk_proj T num_frees (find s))); |
46 (Proof_Context.cterm_of ctxt (Var f), Proof_Context.cterm_of ctxt (mk_proj T num_frees (find s))); |
47 val cfps = map mk_cfp fs; |
47 val cfps = map mk_cfp fs; |
48 in |
48 in |
147 HEADGOAL (rtac ((if null sel_funs then collapse else collapse RS sym) RS trans) THEN' |
147 HEADGOAL (rtac ((if null sel_funs then collapse else collapse RS sym) RS trans) THEN' |
148 (the_default (K all_tac) (Option.map rtac disc_fun_opt)) THEN' REPEAT_DETERM_N m o atac) THEN |
148 (the_default (K all_tac) (Option.map rtac disc_fun_opt)) THEN' REPEAT_DETERM_N m o atac) THEN |
149 unfold_thms_tac ctxt (@{thm split_def} :: unfold_lets @ sel_funs) THEN HEADGOAL (rtac refl); |
149 unfold_thms_tac ctxt (@{thm split_def} :: unfold_lets @ sel_funs) THEN HEADGOAL (rtac refl); |
150 |
150 |
151 fun inst_split_eq ctxt split = |
151 fun inst_split_eq ctxt split = |
152 (case prop_of split of |
152 (case Thm.prop_of split of |
153 @{const Trueprop} $ (Const (@{const_name HOL.eq}, _) $ (Var (_, Type (_, [T, _])) $ _) $ _) => |
153 @{const Trueprop} $ (Const (@{const_name HOL.eq}, _) $ (Var (_, Type (_, [T, _])) $ _) $ _) => |
154 let |
154 let |
155 val s = Name.uu; |
155 val s = Name.uu; |
156 val eq = Abs (Name.uu, T, HOLogic.mk_eq (Free (s, T), Bound 0)); |
156 val eq = Abs (Name.uu, T, HOLogic.mk_eq (Free (s, T), Bound 0)); |
157 val split' = Drule.instantiate' [] [SOME (Proof_Context.cterm_of ctxt eq)] split; |
157 val split' = Drule.instantiate' [] [SOME (Proof_Context.cterm_of ctxt eq)] split; |