src/Pure/tactic.ML
changeset 18977 f24c416a4814
parent 18500 8b1a4e8ed199
child 19056 6ac9dfe98e54
equal deleted inserted replaced
18976:4efb82669880 18977:f24c416a4814
   565 
   565 
   566 (*folding should handle critical pairs!  E.g. K == Inl(0),  S == Inr(Inl(0))
   566 (*folding should handle critical pairs!  E.g. K == Inl(0),  S == Inr(Inl(0))
   567   Returns longest lhs first to avoid folding its subexpressions.*)
   567   Returns longest lhs first to avoid folding its subexpressions.*)
   568 fun sort_lhs_depths defs =
   568 fun sort_lhs_depths defs =
   569   let val keylist = AList.make (term_depth o lhs_of_thm) defs
   569   let val keylist = AList.make (term_depth o lhs_of_thm) defs
   570       val keys = distinct (sort (rev_order o int_ord) (map #2 keylist))
   570       val keys = gen_distinct (op =) (sort (rev_order o int_ord) (map #2 keylist))
   571   in map (AList.find (op =) keylist) keys end;
   571   in map (AList.find (op =) keylist) keys end;
   572 
   572 
   573 val rev_defs = sort_lhs_depths o map symmetric;
   573 val rev_defs = sort_lhs_depths o map symmetric;
   574 
   574 
   575 fun fold_rule defs thm = Library.foldl (fn (th, ds) => rewrite_rule ds th) (thm, rev_defs defs);
   575 fun fold_rule defs thm = Library.foldl (fn (th, ds) => rewrite_rule ds th) (thm, rev_defs defs);