src/HOL/Nominal/nominal_atoms.ML
changeset 18600 20ad06db427b
parent 18579 002d371401f5
child 18626 b6596f579e40
equal deleted inserted replaced
18599:e01112713fdc 18600:20ad06db427b
   372       val pt3           = thm "pt3";
   372       val pt3           = thm "pt3";
   373       val at_pt_inst    = thm "at_pt_inst";
   373       val at_pt_inst    = thm "at_pt_inst";
   374       val pt_set_inst   = thm "pt_set_inst"; 
   374       val pt_set_inst   = thm "pt_set_inst"; 
   375       val pt_unit_inst  = thm "pt_unit_inst";
   375       val pt_unit_inst  = thm "pt_unit_inst";
   376       val pt_prod_inst  = thm "pt_prod_inst"; 
   376       val pt_prod_inst  = thm "pt_prod_inst"; 
       
   377       val pt_nprod_inst = thm "pt_nprod_inst"; 
   377       val pt_list_inst  = thm "pt_list_inst";   
   378       val pt_list_inst  = thm "pt_list_inst";   
   378       val pt_optn_inst  = thm "pt_option_inst";   
   379       val pt_optn_inst  = thm "pt_option_inst";   
   379       val pt_noptn_inst = thm "pt_noption_inst";   
   380       val pt_noptn_inst = thm "pt_noption_inst";   
   380       val pt_fun_inst   = thm "pt_fun_inst";     
   381       val pt_fun_inst   = thm "pt_fun_inst";     
   381 
   382 
   408      (*      fun(pt_<ak>,pt_<ak>)       *)
   409      (*      fun(pt_<ak>,pt_<ak>)       *)
   409      (*      noption(pt_<ak>)           *)
   410      (*      noption(pt_<ak>)           *)
   410      (*      option(pt_<ak>)            *)
   411      (*      option(pt_<ak>)            *)
   411      (*      list(pt_<ak>)              *)
   412      (*      list(pt_<ak>)              *)
   412      (*      *(pt_<ak>,pt_<ak>)         *)
   413      (*      *(pt_<ak>,pt_<ak>)         *)
       
   414      (*      nprod(pt_<ak>,pt_<ak>)     *)
   413      (*      unit                       *)
   415      (*      unit                       *)
   414      (*      set(pt_<ak>)               *)
   416      (*      set(pt_<ak>)               *)
   415      (* are instances of pt_<ak>        *)
   417      (* are instances of pt_<ak>        *)
   416      val thy18 = fold (fn ak_name => fn thy =>
   418      val thy18 = fold (fn ak_name => fn thy =>
   417        let
   419        let
   426           val pt_thm_fun   = at_thm RS (pt_inst RS (pt_inst RS pt_fun_inst));
   428           val pt_thm_fun   = at_thm RS (pt_inst RS (pt_inst RS pt_fun_inst));
   427           val pt_thm_noptn = pt_inst RS pt_noptn_inst; 
   429           val pt_thm_noptn = pt_inst RS pt_noptn_inst; 
   428           val pt_thm_optn  = pt_inst RS pt_optn_inst; 
   430           val pt_thm_optn  = pt_inst RS pt_optn_inst; 
   429           val pt_thm_list  = pt_inst RS pt_list_inst;
   431           val pt_thm_list  = pt_inst RS pt_list_inst;
   430           val pt_thm_prod  = pt_inst RS (pt_inst RS pt_prod_inst);
   432           val pt_thm_prod  = pt_inst RS (pt_inst RS pt_prod_inst);
       
   433           val pt_thm_nprod = pt_inst RS (pt_inst RS pt_nprod_inst);
   431           val pt_thm_unit  = pt_unit_inst;
   434           val pt_thm_unit  = pt_unit_inst;
   432           val pt_thm_set   = pt_inst RS pt_set_inst
   435           val pt_thm_set   = pt_inst RS pt_set_inst
   433        in 
   436        in 
   434 	thy
   437 	thy
   435 	|> AxClass.add_inst_arity_i ("fun",[[cls_name],[cls_name]],[cls_name]) (pt_proof pt_thm_fun)
   438 	|> AxClass.add_inst_arity_i ("fun",[[cls_name],[cls_name]],[cls_name]) (pt_proof pt_thm_fun)
   436         |> AxClass.add_inst_arity_i ("nominal.noption",[[cls_name]],[cls_name]) (pt_proof pt_thm_noptn) 
   439         |> AxClass.add_inst_arity_i ("nominal.noption",[[cls_name]],[cls_name]) (pt_proof pt_thm_noptn) 
   437         |> AxClass.add_inst_arity_i ("Datatype.option",[[cls_name]],[cls_name]) (pt_proof pt_thm_optn)
   440         |> AxClass.add_inst_arity_i ("Datatype.option",[[cls_name]],[cls_name]) (pt_proof pt_thm_optn)
   438         |> AxClass.add_inst_arity_i ("List.list",[[cls_name]],[cls_name]) (pt_proof pt_thm_list)
   441         |> AxClass.add_inst_arity_i ("List.list",[[cls_name]],[cls_name]) (pt_proof pt_thm_list)
   439         |> AxClass.add_inst_arity_i ("*",[[cls_name],[cls_name]],[cls_name]) (pt_proof pt_thm_prod)
   442         |> AxClass.add_inst_arity_i ("*",[[cls_name],[cls_name]],[cls_name]) (pt_proof pt_thm_prod)
       
   443         |> AxClass.add_inst_arity_i ("nominal.nprod",[[cls_name],[cls_name]],[cls_name]) 
       
   444                                     (pt_proof pt_thm_nprod)
   440         |> AxClass.add_inst_arity_i ("Product_Type.unit",[],[cls_name]) (pt_proof pt_thm_unit)
   445         |> AxClass.add_inst_arity_i ("Product_Type.unit",[],[cls_name]) (pt_proof pt_thm_unit)
   441         |> AxClass.add_inst_arity_i ("set",[[cls_name]],[cls_name]) (pt_proof pt_thm_set)
   446         |> AxClass.add_inst_arity_i ("set",[[cls_name]],[cls_name]) (pt_proof pt_thm_set)
   442      end) ak_names thy13; 
   447      end) ak_names thy13; 
   443 
   448 
   444        (*<<<<<<<  fs_<ak> class instances  >>>>>>>*)
   449        (*<<<<<<<  fs_<ak> class instances  >>>>>>>*)
   446        (* abbreviations for some lemmas *)
   451        (* abbreviations for some lemmas *)
   447        val fs1            = thm "fs1";
   452        val fs1            = thm "fs1";
   448        val fs_at_inst     = thm "fs_at_inst";
   453        val fs_at_inst     = thm "fs_at_inst";
   449        val fs_unit_inst   = thm "fs_unit_inst";
   454        val fs_unit_inst   = thm "fs_unit_inst";
   450        val fs_prod_inst   = thm "fs_prod_inst";
   455        val fs_prod_inst   = thm "fs_prod_inst";
       
   456        val fs_nprod_inst  = thm "fs_nprod_inst";
   451        val fs_list_inst   = thm "fs_list_inst";
   457        val fs_list_inst   = thm "fs_list_inst";
   452        val fs_option_inst = thm "fs_option_inst";
   458        val fs_option_inst = thm "fs_option_inst";
   453        val dj_supp        = thm "dj_supp"
   459        val dj_supp        = thm "dj_supp"
   454 
   460 
   455        (* shows that <ak> is an instance of fs_<ak>     *)
   461        (* shows that <ak> is an instance of fs_<ak>     *)
   474         end) ak_names thy) ak_names thy18;
   480         end) ak_names thy) ak_names thy18;
   475 
   481 
   476        (* shows that                  *)
   482        (* shows that                  *)
   477        (*    unit                     *)
   483        (*    unit                     *)
   478        (*    *(fs_<ak>,fs_<ak>)       *)
   484        (*    *(fs_<ak>,fs_<ak>)       *)
       
   485        (*    nprod(fs_<ak>,fs_<ak>)   *)
   479        (*    list(fs_<ak>)            *)
   486        (*    list(fs_<ak>)            *)
   480        (*    option(fs_<ak>)          *) 
   487        (*    option(fs_<ak>)          *) 
   481        (* are instances of fs_<ak>    *)
   488        (* are instances of fs_<ak>    *)
   482 
   489 
   483        val thy24 = fold (fn ak_name => fn thy => 
   490        val thy24 = fold (fn ak_name => fn thy => 
   484         let
   491         let
   485           val cls_name = Sign.full_name (sign_of thy) ("fs_"^ak_name);
   492           val cls_name = Sign.full_name (sign_of thy) ("fs_"^ak_name);
   486           val fs_inst  = PureThy.get_thm thy (Name ("fs_"^ak_name^"_inst"));
   493           val fs_inst  = PureThy.get_thm thy (Name ("fs_"^ak_name^"_inst"));
   487           fun fs_proof thm = EVERY [AxClass.intro_classes_tac [], rtac (thm RS fs1) 1];      
   494           fun fs_proof thm = EVERY [AxClass.intro_classes_tac [], rtac (thm RS fs1) 1];      
   488 
   495 
   489           val fs_thm_unit = fs_unit_inst;
   496           val fs_thm_unit  = fs_unit_inst;
   490           val fs_thm_prod = fs_inst RS (fs_inst RS fs_prod_inst);
   497           val fs_thm_prod  = fs_inst RS (fs_inst RS fs_prod_inst);
   491           val fs_thm_list = fs_inst RS fs_list_inst;
   498           val fs_thm_nprod = fs_inst RS (fs_inst RS fs_nprod_inst);
   492           val fs_thm_optn = fs_inst RS fs_option_inst;
   499           val fs_thm_list  = fs_inst RS fs_list_inst;
       
   500           val fs_thm_optn  = fs_inst RS fs_option_inst;
   493         in 
   501         in 
   494          thy 
   502          thy 
   495          |> AxClass.add_inst_arity_i ("Product_Type.unit",[],[cls_name]) (fs_proof fs_thm_unit) 
   503          |> AxClass.add_inst_arity_i ("Product_Type.unit",[],[cls_name]) (fs_proof fs_thm_unit) 
   496          |> AxClass.add_inst_arity_i ("*",[[cls_name],[cls_name]],[cls_name]) (fs_proof fs_thm_prod)    
   504          |> AxClass.add_inst_arity_i ("*",[[cls_name],[cls_name]],[cls_name]) (fs_proof fs_thm_prod) 
       
   505          |> AxClass.add_inst_arity_i ("nominal.nprod",[[cls_name],[cls_name]],[cls_name]) 
       
   506                                      (fs_proof fs_thm_nprod) 
   497          |> AxClass.add_inst_arity_i ("List.list",[[cls_name]],[cls_name]) (fs_proof fs_thm_list)
   507          |> AxClass.add_inst_arity_i ("List.list",[[cls_name]],[cls_name]) (fs_proof fs_thm_list)
   498          |> AxClass.add_inst_arity_i ("Datatype.option",[[cls_name]],[cls_name]) (fs_proof fs_thm_optn)
   508          |> AxClass.add_inst_arity_i ("Datatype.option",[[cls_name]],[cls_name]) (fs_proof fs_thm_optn)
   499         end) ak_names thy20; 
   509         end) ak_names thy20; 
   500 
   510 
   501        (*<<<<<<<  cp_<ak>_<ai> class instances  >>>>>>>*)
   511        (*<<<<<<<  cp_<ak>_<ai> class instances  >>>>>>>*)