src/ZF/Tools/induct_tacs.ML
changeset 15570 8d8c70b41bab
parent 15531 08c8dad8e399
child 15574 b1d1b5bfc464
equal deleted inserted replaced
15569:1b3115d1a8df 15570:8d8c70b41bab
    87 
    87 
    88 fun find_tname var Bi =
    88 fun find_tname var Bi =
    89   let fun mk_pair (Const("op :",_) $ Free (v,_) $ A) =
    89   let fun mk_pair (Const("op :",_) $ Free (v,_) $ A) =
    90              (v, #1 (dest_Const (head_of A)))
    90              (v, #1 (dest_Const (head_of A)))
    91         | mk_pair _ = raise Match
    91         | mk_pair _ = raise Match
    92       val pairs = mapfilter (try (mk_pair o FOLogic.dest_Trueprop))
    92       val pairs = List.mapPartial (try (mk_pair o FOLogic.dest_Trueprop))
    93           (#2 (strip_context Bi))
    93           (#2 (strip_context Bi))
    94   in case assoc (pairs, var) of
    94   in case assoc (pairs, var) of
    95        NONE => raise Find_tname ("Cannot determine datatype of " ^ quote var)
    95        NONE => raise Find_tname ("Cannot determine datatype of " ^ quote var)
    96      | SOME t => t
    96      | SOME t => t
    97   end;
    97   end;
   176           |> (#1 o PureThy.add_thmss [(("simps", simps), [Simplifier.simp_add_global])])
   176           |> (#1 o PureThy.add_thmss [(("simps", simps), [Simplifier.simp_add_global])])
   177           |> DatatypesData.put
   177           |> DatatypesData.put
   178               (Symtab.update
   178               (Symtab.update
   179                ((big_rec_name, dt_info), DatatypesData.get thy))
   179                ((big_rec_name, dt_info), DatatypesData.get thy))
   180           |> ConstructorsData.put
   180           |> ConstructorsData.put
   181                (foldr Symtab.update (con_pairs, ConstructorsData.get thy))
   181                (Library.foldr Symtab.update (con_pairs, ConstructorsData.get thy))
   182           |> Theory.parent_path
   182           |> Theory.parent_path
   183   end;
   183   end;
   184 
   184 
   185 fun rep_datatype raw_elim raw_induct raw_case_eqns raw_recursor_eqns thy =
   185 fun rep_datatype raw_elim raw_induct raw_case_eqns raw_recursor_eqns thy =
   186   let
   186   let