src/HOLCF/domain/theorems.ML
changeset 16778 2162c0de4673
parent 16486 1a12cdb6ee6b
child 16842 5979c46853d1
equal deleted inserted replaced
16777:555c8951f05c 16778:2162c0de4673
   112 
   112 
   113 val when_appl = appl_of_def ax_when_def;
   113 val when_appl = appl_of_def ax_when_def;
   114 val con_appls = map appl_of_def axs_con_def;
   114 val con_appls = map appl_of_def axs_con_def;
   115 
   115 
   116 local
   116 local
   117   fun arg2typ n arg = let val t = TVar (("'a",n),["Pcpo.pcpo"])
   117   fun arg2typ n arg = let val t = TVar (("'a",n),pcpoS)
   118                       in (n+1, if is_lazy arg then mk_uT t else t) end;
   118                       in (n+1, if is_lazy arg then mk_uT t else t) end;
   119   fun args2typ n [] = (n,oneT)
   119   fun args2typ n [] = (n,oneT)
   120   |   args2typ n [arg] = arg2typ n arg
   120   |   args2typ n [arg] = arg2typ n arg
   121   |   args2typ n (arg::args) = let val (n1,t1) = arg2typ n arg;
   121   |   args2typ n (arg::args) = let val (n1,t1) = arg2typ n arg;
   122                                    val (n2,t2) = args2typ n1 args
   122                                    val (n2,t2) = args2typ n1 args
   175                              strict(%%:(dis_name con)))) [
   175                              strict(%%:(dis_name con)))) [
   176                                 rtac when_strict 1]) cons;
   176                                 rtac when_strict 1]) cons;
   177   val dis_apps = let fun one_dis c (con,args)= pg axs_dis_def
   177   val dis_apps = let fun one_dis c (con,args)= pg axs_dis_def
   178                    (lift_defined %: (nonlazy args,
   178                    (lift_defined %: (nonlazy args,
   179                         (mk_trp((%%:(dis_name c))`(con_app con args) ===
   179                         (mk_trp((%%:(dis_name c))`(con_app con args) ===
   180                               %%:(if con=c then "TT" else "FF"))))) [
   180                               %%:(if con=c then TT_N else FF_N))))) [
   181                                 asm_simp_tac (HOLCF_ss addsimps when_rews) 1];
   181                                 asm_simp_tac (HOLCF_ss addsimps when_rews) 1];
   182         in List.concat(map (fn (c,_) => map (one_dis c) cons) cons) end;
   182         in List.concat(map (fn (c,_) => map (one_dis c) cons) cons) end;
   183   val dis_defins = map (fn (con,args) => pg [] (defined(%:x_name) ==> 
   183   val dis_defins = map (fn (con,args) => pg [] (defined(%:x_name) ==> 
   184                       defined(%%:(dis_name con)`%x_name)) [
   184                       defined(%%:(dis_name con)`%x_name)) [
   185                                 rtac casedist 1,
   185                                 rtac casedist 1,
   193                              strict(%%:(mat_name con)))) [
   193                              strict(%%:(mat_name con)))) [
   194                                 rtac when_strict 1]) cons;
   194                                 rtac when_strict 1]) cons;
   195   val mat_apps = let fun one_mat c (con,args)= pg axs_mat_def
   195   val mat_apps = let fun one_mat c (con,args)= pg axs_mat_def
   196                    (lift_defined %: (nonlazy args,
   196                    (lift_defined %: (nonlazy args,
   197                         (mk_trp((%%:(mat_name c))`(con_app con args) ===
   197                         (mk_trp((%%:(mat_name c))`(con_app con args) ===
   198                               (if con=c then (%%:"return")`(mk_ctuple (map %# args)) else %%:"fail"))))) [
   198                               (if con=c
   199                                 asm_simp_tac (HOLCF_ss addsimps when_rews) 1];
   199                                   then %%:returnN`(mk_ctuple (map %# args))
       
   200                                   else %%:failN)))))
       
   201                    [asm_simp_tac (HOLCF_ss addsimps when_rews) 1];
   200         in List.concat(map (fn (c,_) => map (one_mat c) cons) cons) end;
   202         in List.concat(map (fn (c,_) => map (one_mat c) cons) cons) end;
   201 in mat_stricts @ mat_apps end;
   203 in mat_stricts @ mat_apps end;
   202 
   204 
   203 val con_stricts = List.concat(map (fn (con,args) => map (fn vn =>
   205 val con_stricts = List.concat(map (fn (con,args) => map (fn vn =>
   204                         pg con_appls
   206                         pg con_appls
   540                                 ind_prems_tac prems]) 
   542                                 ind_prems_tac prems]) 
   541                                    (finites~~(atomize finite_ind)) ))
   543                                    (finites~~(atomize finite_ind)) ))
   542 ) end (* let *) else
   544 ) end (* let *) else
   543   (mapn (fn n => fn dn => read_instantiate_sg (sign_of thy) 
   545   (mapn (fn n => fn dn => read_instantiate_sg (sign_of thy) 
   544                     [("P",dn^"_finite "^x_name n)] excluded_middle) 1 dnames,
   546                     [("P",dn^"_finite "^x_name n)] excluded_middle) 1 dnames,
   545    pg'' thy [] (Library.foldr (op ===>) (mapn (fn n => K(mk_trp(%%:"adm" $ %:(P_name n))))
   547    pg'' thy [] (Library.foldr (op ===>) (mapn (fn n => K(mk_trp(%%:admN $ %:(P_name n))))
   546                1 dnames, ind_term (fn n => fn dn => %:(P_name n) $ %:(x_name n))))
   548                1 dnames, ind_term (fn n => fn dn => %:(P_name n) $ %:(x_name n))))
   547                    (fn prems => map (fn ax_reach => rtac (ax_reach RS subst) 1) 
   549                    (fn prems => map (fn ax_reach => rtac (ax_reach RS subst) 1) 
   548                                     axs_reach @ [
   550                                     axs_reach @ [
   549                                 quant_tac 1,
   551                                 quant_tac 1,
   550                                 rtac (adm_impl_admw RS wfix_ind) 1,
   552                                 rtac (adm_impl_admw RS wfix_ind) 1,