equal
deleted
inserted
replaced
306 |
306 |
307 fun find_cterm p t = |
307 fun find_cterm p t = |
308 if p t then t else |
308 if p t then t else |
309 case Thm.term_of t of |
309 case Thm.term_of t of |
310 _$_ => (find_cterm p (Thm.dest_fun t) handle CTERM _ => find_cterm p (Thm.dest_arg t)) |
310 _$_ => (find_cterm p (Thm.dest_fun t) handle CTERM _ => find_cterm p (Thm.dest_arg t)) |
311 | Abs (_,_,_) => find_cterm p (Thm.dest_abs NONE t |> snd) |
311 | Abs (_,_,_) => find_cterm p (Thm.dest_abs t |> snd) |
312 | _ => raise CTERM ("find_cterm",[t]); |
312 | _ => raise CTERM ("find_cterm",[t]); |
313 |
313 |
314 fun is_comb t = (case Thm.term_of t of _ $ _ => true | _ => false); |
314 fun is_comb t = (case Thm.term_of t of _ $ _ => true | _ => false); |
315 |
315 |
316 fun is_binop ct ct' = ct aconvc (Thm.dest_fun (Thm.dest_fun ct')) |
316 fun is_binop ct ct' = ct aconvc (Thm.dest_fun (Thm.dest_fun ct')) |
494 val strip_exists = |
494 val strip_exists = |
495 let |
495 let |
496 fun h (acc, t) = |
496 fun h (acc, t) = |
497 case Thm.term_of t of |
497 case Thm.term_of t of |
498 Const(\<^const_name>\<open>Ex\<close>,_)$Abs(_,_,_) => |
498 Const(\<^const_name>\<open>Ex\<close>,_)$Abs(_,_,_) => |
499 h (Thm.dest_abs NONE (Thm.dest_arg t) |>> (fn v => v::acc)) |
499 h (Thm.dest_abs (Thm.dest_arg t) |>> (fn v => v::acc)) |
500 | _ => (acc,t) |
500 | _ => (acc,t) |
501 in fn t => h ([],t) |
501 in fn t => h ([],t) |
502 end |
502 end |
503 fun name_of x = |
503 fun name_of x = |
504 case Thm.term_of x of |
504 case Thm.term_of x of |
539 val strip_forall = |
539 val strip_forall = |
540 let |
540 let |
541 fun h (acc, t) = |
541 fun h (acc, t) = |
542 case Thm.term_of t of |
542 case Thm.term_of t of |
543 Const(\<^const_name>\<open>All\<close>,_)$Abs(_,_,_) => |
543 Const(\<^const_name>\<open>All\<close>,_)$Abs(_,_,_) => |
544 h (Thm.dest_abs NONE (Thm.dest_arg t) |>> (fn v => v::acc)) |
544 h (Thm.dest_abs (Thm.dest_arg t) |>> (fn v => v::acc)) |
545 | _ => (acc,t) |
545 | _ => (acc,t) |
546 in fn t => h ([],t) |
546 in fn t => h ([],t) |
547 end |
547 end |
548 |
548 |
549 fun f ct = |
549 fun f ct = |