src/HOL/Tools/BNF/bnf_gfp_rec_sugar.ML
changeset 59945 cfbaee8cdf1d
parent 59936 b8ffc3dc9e24
child 59946 c18df9eea901
equal deleted inserted replaced
59944:83071f4c8ae6 59945:cfbaee8cdf1d
    41      sel_defs: thm list,
    41      sel_defs: thm list,
    42      fp_nesting_maps: thm list,
    42      fp_nesting_maps: thm list,
    43      fp_nesting_map_ident0s: thm list,
    43      fp_nesting_map_ident0s: thm list,
    44      fp_nesting_map_comps: thm list,
    44      fp_nesting_map_comps: thm list,
    45      ctr_specs: corec_ctr_spec list}
    45      ctr_specs: corec_ctr_spec list}
       
    46 
       
    47   val abs_tuple_balanced: term list -> term -> term
    46 
    48 
    47   val fold_rev_let_if_case: Proof.context -> (term list -> term -> 'a -> 'a) -> typ list ->
    49   val fold_rev_let_if_case: Proof.context -> (term list -> term -> 'a -> 'a) -> typ list ->
    48     term -> 'a -> 'a
    50     term -> 'a -> 'a
    49   val massage_let_if_case: Proof.context -> (term -> bool) -> (typ list -> term -> term) ->
    51   val massage_let_if_case: Proof.context -> (term -> bool) -> (typ list -> term -> term) ->
    50     typ list -> term -> term
    52     typ list -> term -> term
   155    fp_nesting_map_ident0s: thm list,
   157    fp_nesting_map_ident0s: thm list,
   156    fp_nesting_map_comps: thm list,
   158    fp_nesting_map_comps: thm list,
   157    ctr_specs: corec_ctr_spec list};
   159    ctr_specs: corec_ctr_spec list};
   158 
   160 
   159 exception NO_MAP of term;
   161 exception NO_MAP of term;
       
   162 
       
   163 val abs_tuple_balanced = HOLogic.tupled_lambda o mk_tuple_balanced;
   160 
   164 
   161 fun sort_list_duplicates xs = map snd (sort (int_ord o apply2 fst) xs);
   165 fun sort_list_duplicates xs = map snd (sort (int_ord o apply2 fst) xs);
   162 
   166 
   163 val mk_conjs = try (foldr1 HOLogic.mk_conj) #> the_default @{const True};
   167 val mk_conjs = try (foldr1 HOLogic.mk_conj) #> the_default @{const True};
   164 val mk_disjs = try (foldr1 HOLogic.mk_disj) #> the_default @{const False};
   168 val mk_disjs = try (foldr1 HOLogic.mk_disj) #> the_default @{const False};
   560      is_some gfp_sugar_thms, lthy)
   564      is_some gfp_sugar_thms, lthy)
   561   end;
   565   end;
   562 
   566 
   563 val undef_const = Const (@{const_name undefined}, dummyT);
   567 val undef_const = Const (@{const_name undefined}, dummyT);
   564 
   568 
   565 val abs_tuple_balanced = HOLogic.tupled_lambda o mk_tuple_balanced;
       
   566 
       
   567 fun abstract vs =
   569 fun abstract vs =
   568   let
   570   let
   569     fun abs n (t $ u) = abs n t $ abs n u
   571     fun abs n (t $ u) = abs n t $ abs n u
   570       | abs n (Abs (v, T, b)) = Abs (v, T, abs (n + 1) b)
   572       | abs n (Abs (v, T, b)) = Abs (v, T, abs (n + 1) b)
   571       | abs n t =
   573       | abs n t =