163 (Const ("Pair",_) $ Bound n $ t)))) = |
163 (Const ("Pair",_) $ Bound n $ t)))) = |
164 if m = k andalso n = k-1 andalso Pair_pat (k-2) t |
164 if m = k andalso n = k-1 andalso Pair_pat (k-2) t |
165 then Some f else None |
165 then Some f else None |
166 | split_pat k (Const ("split", _) $ Abs (_, _, t)) = split_pat (k+1) t |
166 | split_pat k (Const ("split", _) $ Abs (_, _, t)) = split_pat (k+1) t |
167 | split_pat k _ = None; |
167 | split_pat k _ = None; |
168 fun proc _ _ (s as |
168 fun proc sg _ (s as |
169 (Const ("split", _) $ Abs (_, _, |
169 (Const ("split", _) $ Abs (_, _, |
170 (Const ("split", _) $ Abs (_, _, t))))) = (case split_pat 2 t of |
170 (Const ("split", _) $ Abs (_, _, t))))) = (case split_pat 2 t of |
171 Some f => (let val fvar = Free ("f", fastype_of f); |
171 Some f => (let val fvar = Free ("f", fastype_of f); |
172 fun atom_fun t = if t = f then fvar else atom t |
172 fun atom_fun t = if t = f then fvar else atom t |
173 and atom (Abs (x, T, t)) = Abs (x, T,atom_fun t) |
173 and atom (Abs (x, T, t)) = Abs (x, T,atom_fun t) |
174 | atom (t $ u) = atom_fun t $ atom_fun u |
174 | atom (t $ u) = atom_fun t $ atom_fun u |
175 | atom x = x; |
175 | atom x = x; |
176 val ct = cterm_of (sign_of thy) (HOLogic.mk_Trueprop |
176 val ct = cterm_of sg (HOLogic.mk_Trueprop |
177 (HOLogic.mk_eq (atom_fun s,fvar))); |
177 (HOLogic.mk_eq (atom_fun s,fvar))); |
178 val ss = HOL_basic_ss addsimps [cond_split_eta]; |
178 val ss = HOL_basic_ss addsimps [cond_split_eta]; |
179 in Some (meta_eq (prove_goalw_cterm [] ct (K [simp_tac ss 1]))) end) |
179 in Some (meta_eq (prove_goalw_cterm [] ct (K [simp_tac ss 1]))) end) |
180 | None => None) |
180 | None => None) |
181 | proc _ _ _ = None; |
181 | proc _ _ _ = None; |