src/HOL/HOLCF/ex/Pattern_Match.thy
changeset 80634 a90ab1ea6458
parent 79336 032a31db4c6f
child 80636 4041e7c8059d
equal deleted inserted replaced
80633:276b07a1b5f5 80634:a90ab1ea6458
   459     fun mk_tuple_pat [] = succeed_const \<^Type>\<open>unit\<close>
   459     fun mk_tuple_pat [] = succeed_const \<^Type>\<open>unit\<close>
   460       | mk_tuple_pat ps = foldr1 mk_pair_pat ps;
   460       | mk_tuple_pat ps = foldr1 mk_pair_pat ps;
   461 
   461 
   462     (* define pattern combinators *)
   462     (* define pattern combinators *)
   463     local
   463     local
   464       val tns = map (fst o dest_TFree) (snd (dest_Type lhsT));
   464       val tns = map (fst o dest_TFree) (dest_Type_args lhsT);
   465 
   465 
   466       fun pat_eqn (i, (bind, (con, args))) : binding * term * mixfix =
   466       fun pat_eqn (i, (bind, (con, args))) : binding * term * mixfix =
   467         let
   467         let
   468           val pat_bind = Binding.suffix_name "_pat" bind;
   468           val pat_bind = Binding.suffix_name "_pat" bind;
   469           val Ts = map snd args;
   469           val Ts = map snd args;
   525       val thy = Sign.add_trrules trans_rules thy;
   525       val thy = Sign.add_trrules trans_rules thy;
   526     end;
   526     end;
   527 
   527 
   528     (* prove strictness and reduction rules of pattern combinators *)
   528     (* prove strictness and reduction rules of pattern combinators *)
   529     local
   529     local
   530       val tns = map (fst o dest_TFree) (snd (dest_Type lhsT));
   530       val tns = map (fst o dest_TFree) (dest_Type_args lhsT);
   531       val rn = singleton (Name.variant_list tns) "'r";
   531       val rn = singleton (Name.variant_list tns) "'r";
   532       val R = TFree (rn, \<^sort>\<open>pcpo\<close>);
   532       val R = TFree (rn, \<^sort>\<open>pcpo\<close>);
   533       fun pat_lhs (pat, args) =
   533       fun pat_lhs (pat, args) =
   534         let
   534         let
   535           val Ts = map snd args;
   535           val Ts = map snd args;