src/Provers/splitter.ML
changeset 20664 ffbc5a57191a
parent 20237 5daab2c78b8e
child 21588 cd0dc678a205
equal deleted inserted replaced
20663:2024d9f7df9c 20664:ffbc5a57191a
   163 
   163 
   164 (* check if the innermost abstraction that needs to be removed
   164 (* check if the innermost abstraction that needs to be removed
   165    has a body of type T; otherwise the expansion thm will fail later on
   165    has a body of type T; otherwise the expansion thm will fail later on
   166 *)
   166 *)
   167 fun type_test (T,lbnos,apsns) =
   167 fun type_test (T,lbnos,apsns) =
   168   let val (_,U,_) = List.nth(apsns, Library.foldl Int.min (hd lbnos, tl lbnos))
   168   let val (_,U: typ,_) = List.nth(apsns, Library.foldl Int.min (hd lbnos, tl lbnos))
   169   in T=U end;
   169   in T=U end;
   170 
   170 
   171 (*************************************************************************
   171 (*************************************************************************
   172    Create a "split_pack".
   172    Create a "split_pack".
   173 
   173 
   194           comes first ! If the terms in ts don't contain variables bound
   194           comes first ! If the terms in ts don't contain variables bound
   195           by other than meta-quantifiers, apsns is empty, because no further
   195           by other than meta-quantifiers, apsns is empty, because no further
   196           lifting is required before applying the split-theorem.
   196           lifting is required before applying the split-theorem.
   197 ******************************************************************************)
   197 ******************************************************************************)
   198 
   198 
   199 fun mk_split_pack (thm, T, T', n, ts, apsns, pos, TB, t) =
   199 fun mk_split_pack (thm, T: typ, T', n, ts, apsns, pos, TB, t) =
   200   if n > length ts then []
   200   if n > length ts then []
   201   else let val lev = length apsns
   201   else let val lev = length apsns
   202            val lbnos = Library.foldl add_lbnos ([],Library.take(n,ts))
   202            val lbnos = Library.foldl add_lbnos ([],Library.take(n,ts))
   203            val flbnos = List.filter (fn i => i < lev) lbnos
   203            val flbnos = List.filter (fn i => i < lev) lbnos
   204            val tt = incr_boundvars (~lev) t
   204            val tt = incr_boundvars (~lev) t
   396 ****************************************************************************)
   396 ****************************************************************************)
   397 fun split_asm_tac []     = K no_tac
   397 fun split_asm_tac []     = K no_tac
   398   | split_asm_tac splits =
   398   | split_asm_tac splits =
   399 
   399 
   400   let val cname_list = map (fst o fst o split_thm_info) splits;
   400   let val cname_list = map (fst o fst o split_thm_info) splits;
   401       fun is_case (a,_) = a mem cname_list;
       
   402       fun tac (t,i) =
   401       fun tac (t,i) =
   403           let val n = find_index (exists_Const is_case)
   402           let val n = find_index (exists_Const (member (op =) cname_list o #1))
   404                                  (Logic.strip_assums_hyp t);
   403                                  (Logic.strip_assums_hyp t);
   405               fun first_prem_is_disj (Const ("==>", _) $ (Const (c, _)
   404               fun first_prem_is_disj (Const ("==>", _) $ (Const (c, _)
   406                     $ (Const (s, _) $ _ $ _ )) $ _ ) = c = const_Trueprop andalso s = const_or
   405                     $ (Const (s, _) $ _ $ _ )) $ _ ) = c = const_Trueprop andalso s = const_or
   407               |   first_prem_is_disj (Const("all",_)$Abs(_,_,t)) =
   406               |   first_prem_is_disj (Const("all",_)$Abs(_,_,t)) =
   408                                         first_prem_is_disj t
   407                                         first_prem_is_disj t