src/Pure/thm.ML
changeset 4036 bd686e39bff8
parent 4018 09b77900af0f
child 4045 deda17b83bf4
equal deleted inserted replaced
4035:6ffbc7b11abd 4036:bd686e39bff8
  1648 
  1648 
  1649 (* add_simprocs *)
  1649 (* add_simprocs *)
  1650 
  1650 
  1651 fun add_proc (mss as Mss {rules, congs, procs, bounds, prems, mk_rews, termless},
  1651 fun add_proc (mss as Mss {rules, congs, procs, bounds, prems, mk_rews, termless},
  1652     (name, lhs as Cterm {sign_ref, t, ...}, proc, id)) =
  1652     (name, lhs as Cterm {sign_ref, t, ...}, proc, id)) =
  1653   (trace_term ("Adding simplification procedure " ^ name ^ " for:")
  1653   (trace_term ("Adding simplification procedure " ^ quote name ^ " for:")
  1654       (Sign.deref sign_ref) t;
  1654       (Sign.deref sign_ref) t;
  1655     mk_mss (rules, congs,
  1655     mk_mss (rules, congs,
  1656       Net.insert_term ((t, mk_simproc (name, proc, lhs, id)), procs, eq_simproc)
  1656       Net.insert_term ((t, mk_simproc (name, proc, lhs, id)), procs, eq_simproc)
  1657         handle Net.INSERT => (trace_warning "ignored duplicate"; procs),
  1657         handle Net.INSERT => (trace_warning "ignored duplicate"; procs),
  1658         bounds, prems, mk_rews, termless));
  1658         bounds, prems, mk_rews, termless));
  1830       end
  1830       end
  1831 
  1831 
  1832       fun proc_rews _ ([]:simproc list) = None
  1832       fun proc_rews _ ([]:simproc list) = None
  1833         | proc_rews eta_t ({name, proc, lhs = Cterm {t = plhs, ...}, ...} :: ps) =
  1833         | proc_rews eta_t ({name, proc, lhs = Cterm {t = plhs, ...}, ...} :: ps) =
  1834             if Pattern.matches tsigt (plhs, t) then
  1834             if Pattern.matches tsigt (plhs, t) then
  1835              (trace_term ("Trying procedure " ^ name ^ " on:") signt eta_t;
  1835              (trace_term ("Trying procedure " ^ quote name ^ " on:") signt eta_t;
  1836               case proc signt prems eta_t of
  1836               case proc signt prems eta_t of
  1837                 None => (trace "FAILED"; proc_rews eta_t ps)
  1837                 None => (trace "FAILED"; proc_rews eta_t ps)
  1838               | Some raw_thm =>
  1838               | Some raw_thm =>
  1839                  (trace_thm ("Procedure " ^ name ^ " proved rewrite rule:") raw_thm;
  1839                  (trace_thm ("Procedure " ^ quote name ^ " proved rewrite rule:") raw_thm;
  1840                    (case rews (mk_procrule raw_thm) of
  1840                    (case rews (mk_procrule raw_thm) of
  1841                      None => (trace "IGNORED"; proc_rews eta_t ps)
  1841                      None => (trace "IGNORED"; proc_rews eta_t ps)
  1842                    | some => some)))
  1842                    | some => some)))
  1843             else proc_rews eta_t ps;
  1843             else proc_rews eta_t ps;
  1844   in
  1844   in