src/HOL/BNF/Tools/bnf_fp_util.ML
changeset 53032 953534445ab6
parent 52987 b44a11b87b85
child 53037 e5fa456890b4
equal deleted inserted replaced
53031:83cbe188855a 53032:953534445ab6
   138   val split_conj_prems: int -> thm -> thm
   138   val split_conj_prems: int -> thm -> thm
   139 
   139 
   140   val mk_sumTN: typ list -> typ
   140   val mk_sumTN: typ list -> typ
   141   val mk_sumTN_balanced: typ list -> typ
   141   val mk_sumTN_balanced: typ list -> typ
   142 
   142 
   143   val id_const: typ -> term
   143   val mk_convol: term * term -> term
   144 
   144 
   145   val Inl_const: typ -> typ -> term
   145   val Inl_const: typ -> typ -> term
   146   val Inr_const: typ -> typ -> term
   146   val Inr_const: typ -> typ -> term
   147 
   147 
   148   val mk_Inl: typ -> term -> term
   148   val mk_Inl: typ -> term -> term
   370   | dest_tupleT n (Type (@{type_name prod}, [T, T'])) = T :: dest_tupleT (n - 1) T';
   370   | dest_tupleT n (Type (@{type_name prod}, [T, T'])) = T :: dest_tupleT (n - 1) T';
   371 
   371 
   372 val mk_sumTN = Library.foldr1 mk_sumT;
   372 val mk_sumTN = Library.foldr1 mk_sumT;
   373 val mk_sumTN_balanced = Balanced_Tree.make mk_sumT;
   373 val mk_sumTN_balanced = Balanced_Tree.make mk_sumT;
   374 
   374 
   375 fun id_const T = Const (@{const_name id}, T --> T);
   375 fun mk_convol (f, g) =
       
   376   let
       
   377     val (fU, fTU) = `range_type (fastype_of f);
       
   378     val ((gT, gU), gTU) = `dest_funT (fastype_of g);
       
   379     val convolT = fTU --> gTU --> gT --> HOLogic.mk_prodT (fU, gU);
       
   380   in Const (@{const_name convol}, convolT) $ f $ g end;
   376 
   381 
   377 fun Inl_const LT RT = Const (@{const_name Inl}, LT --> mk_sumT (LT, RT));
   382 fun Inl_const LT RT = Const (@{const_name Inl}, LT --> mk_sumT (LT, RT));
   378 fun mk_Inl RT t = Inl_const (fastype_of t) RT $ t;
   383 fun mk_Inl RT t = Inl_const (fastype_of t) RT $ t;
   379 
   384 
   380 fun Inr_const LT RT = Const (@{const_name Inr}, RT --> mk_sumT (LT, RT));
   385 fun Inr_const LT RT = Const (@{const_name Inr}, RT --> mk_sumT (LT, RT));