src/HOL/Codatatype/Tools/bnf_fp_util.ML
changeset 49368 df359ce891ac
parent 49342 8ea4bad49ed5
child 49389 da621dc65146
equal deleted inserted replaced
49367:a1e811aa0fb8 49368:df359ce891ac
    97   val mk_predT: typ -> typ;
    97   val mk_predT: typ -> typ;
    98 
    98 
    99   val mk_sumTN: typ list -> typ
    99   val mk_sumTN: typ list -> typ
   100   val mk_sumTN_balanced: typ list -> typ
   100   val mk_sumTN_balanced: typ list -> typ
   101 
   101 
       
   102   val id_const: typ -> term
       
   103   val id_abs: typ -> term
       
   104 
   102   val Inl_const: typ -> typ -> term
   105   val Inl_const: typ -> typ -> term
   103   val Inr_const: typ -> typ -> term
   106   val Inr_const: typ -> typ -> term
   104 
   107 
   105   val mk_Inl: typ -> term -> term
   108   val mk_Inl: typ -> term -> term
   106   val mk_Inr: typ -> term -> term
   109   val mk_Inr: typ -> term -> term
   254   | dest_tupleT n (Type (@{type_name prod}, [T, T'])) = T :: dest_tupleT (n - 1) T';
   257   | dest_tupleT n (Type (@{type_name prod}, [T, T'])) = T :: dest_tupleT (n - 1) T';
   255 
   258 
   256 val mk_sumTN = Library.foldr1 mk_sumT;
   259 val mk_sumTN = Library.foldr1 mk_sumT;
   257 val mk_sumTN_balanced = Balanced_Tree.make mk_sumT;
   260 val mk_sumTN_balanced = Balanced_Tree.make mk_sumT;
   258 
   261 
       
   262 fun id_const T = Const (@{const_name id}, T --> T);
       
   263 fun id_abs T = Abs (Name.uu, T, Bound 0);
       
   264 
   259 fun Inl_const LT RT = Const (@{const_name Inl}, LT --> mk_sumT (LT, RT));
   265 fun Inl_const LT RT = Const (@{const_name Inl}, LT --> mk_sumT (LT, RT));
   260 fun mk_Inl RT t = Inl_const (fastype_of t) RT $ t;
   266 fun mk_Inl RT t = Inl_const (fastype_of t) RT $ t;
   261 
   267 
   262 fun Inr_const LT RT = Const (@{const_name Inr}, RT --> mk_sumT (LT, RT));
   268 fun Inr_const LT RT = Const (@{const_name Inr}, RT --> mk_sumT (LT, RT));
   263 fun mk_Inr LT t = Inr_const LT (fastype_of t) $ t;
   269 fun mk_Inr LT t = Inr_const LT (fastype_of t) $ t;