src/HOL/Tools/Sledgehammer/sledgehammer_fact.ML
changeset 50733 7ce87037fbeb
parent 50586 e31ee2076db1
child 50734 73612ad116e6
equal deleted inserted replaced
50732:b2e7490a1b3d 50733:7ce87037fbeb
   329 
   329 
   330 fun if_thm_before th th' =
   330 fun if_thm_before th th' =
   331   if Theory.subthy (pairself Thm.theory_of_thm (th, th')) then th else th'
   331   if Theory.subthy (pairself Thm.theory_of_thm (th, th')) then th else th'
   332 
   332 
   333 fun build_all_names name_of facts =
   333 fun build_all_names name_of facts =
   334   Termtab.fold
   334   let
   335       (fn (_, aliases as main :: _) =>
   335     fun cons_thm (_, th) = Termtab.cons_list (normalize_eq_etc (prop_of th), th)
   336           fold (fn alias =>
   336     fun add_alias canon alias =
   337                    Symtab.update (name_of alias,
   337       Symtab.update (name_of alias, name_of (if_thm_before canon alias))
   338                                   name_of (if_thm_before main alias))) aliases)
   338     fun add_aliases (_, aliases as canon :: _) = fold (add_alias canon) aliases
   339       (fold_rev (fn (_, thm) =>
   339     val tab = fold_rev cons_thm facts Termtab.empty
   340                     Termtab.cons_list (normalize_eq_etc (prop_of thm), thm))
   340   in Termtab.fold add_aliases tab Symtab.empty end
   341             facts Termtab.empty)
       
   342       Symtab.empty
       
   343 
   341 
   344 fun uniquify facts =
   342 fun uniquify facts =
   345   Termtab.fold (cons o snd)
   343   Termtab.fold (cons o snd)
   346       (fold (Termtab.default o `(normalize_eq_etc o prop_of o snd)) facts
   344       (fold (Termtab.default o `(normalize_eq_etc o prop_of o snd)) facts
   347             Termtab.empty) []
   345             Termtab.empty) []