src/HOL/Tools/BNF/bnf_gfp_grec_sugar_util.ML
changeset 64627 8d7cb22482e3
parent 64558 63c76802ab5e
child 64705 7596b0736ab9
equal deleted inserted replaced
64626:f6d0578b46c9 64627:8d7cb22482e3
   207 
   207 
   208     fun build_applied_map TU t =
   208     fun build_applied_map TU t =
   209       if op = TU then
   209       if op = TU then
   210         t
   210         t
   211       else
   211       else
   212         (case try (build_map ctxt [] (the o AList.lookup (op =) AB_fs)) TU of
   212         (case try (build_map ctxt [] [] (the o AList.lookup (op =) AB_fs)) TU of
   213           SOME mapx => mapx $ t
   213           SOME mapx => mapx $ t
   214         | NONE => raise UNNATURAL ());
   214         | NONE => raise UNNATURAL ());
   215 
   215 
   216     fun unextensionalize (f $ (x as Free _), rhs) = unextensionalize (f, lambda x rhs)
   216     fun unextensionalize (f $ (x as Free _), rhs) = unextensionalize (f, lambda x rhs)
   217       | unextensionalize tu = tu;
   217       | unextensionalize tu = tu;
   354       {outer_buffer = outer_buffer, ctr_guards = ctr_guards, inner_buffer = inner_buffer};
   354       {outer_buffer = outer_buffer, ctr_guards = ctr_guards, inner_buffer = inner_buffer};
   355 
   355 
   356     fun mk_friend_spec () =
   356     fun mk_friend_spec () =
   357       let
   357       let
   358         fun encapsulate_nested U T free =
   358         fun encapsulate_nested U T free =
   359           betapply (build_map ctxt [] (fn (T, _) =>
   359           betapply (build_map ctxt [] [] (fn (T, _) =>
   360               if T = domain_type VLeaf0_T then Abs (Name.uu, T, VLeaf0 $ Bound 0)
   360               if T = domain_type VLeaf0_T then Abs (Name.uu, T, VLeaf0 $ Bound 0)
   361               else Abs (Name.uu, T, Bound 0)) (T, U),
   361               else Abs (Name.uu, T, Bound 0)) (T, U),
   362             free);
   362             free);
   363 
   363 
   364         val preT = YifyT (domain_type (fastype_of ctor));
   364         val preT = YifyT (domain_type (fastype_of ctor));