src/HOL/BNF/Tools/bnf_comp.ML
changeset 49630 9f6ca87ab405
parent 49586 d5e342ffe91e
child 49669 620fa6272c48
equal deleted inserted replaced
49629:99700c4e0b33 49630:9f6ca87ab405
   156     val (sets, sets_alt) = map_split mk_set (0 upto ilive - 1);
   156     val (sets, sets_alt) = map_split mk_set (0 upto ilive - 1);
   157 
   157 
   158     (*(inner_1.bd +c ... +c inner_m.bd) *c outer.bd*)
   158     (*(inner_1.bd +c ... +c inner_m.bd) *c outer.bd*)
   159     val bd = Term.absdummy CCA (mk_cprod (Library.foldr1 (uncurry mk_csum) inner_bds) outer_bd);
   159     val bd = Term.absdummy CCA (mk_cprod (Library.foldr1 (uncurry mk_csum) inner_bds) outer_bd);
   160 
   160 
   161     fun map_id_tac {context = ctxt, ...} =
   161     fun map_id_tac _ =
   162       let
   162       mk_comp_map_id_tac (map_id_of_bnf outer) (map_cong_of_bnf outer)
   163         (*order the theorems by reverse size to prevent bad interaction with nonconfluent rewrite
   163         (map map_id_of_bnf inners);
   164           rules*)
       
   165         val thms = (map map_id_of_bnf inners
       
   166           |> map (`(Term.size_of_term o Thm.prop_of))
       
   167           |> sort (rev_order o int_ord o pairself fst)
       
   168           |> map snd) @ [map_id_of_bnf outer];
       
   169       in
       
   170         (EVERY' (map (fn thm => subst_tac ctxt NONE [thm]) thms) THEN' rtac refl) 1
       
   171       end;
       
   172 
   164 
   173     fun map_comp_tac _ =
   165     fun map_comp_tac _ =
   174       mk_comp_map_comp_tac (map_comp_of_bnf outer) (map_cong_of_bnf outer)
   166       mk_comp_map_comp_tac (map_comp_of_bnf outer) (map_cong_of_bnf outer)
   175         (map map_comp_of_bnf inners);
   167         (map map_comp_of_bnf inners);
   176 
   168