854 else (Thm.incr_indexes (maxt+1) thm, Thm.cterm_incr_indexes (maxt+1) elhs); |
854 else (Thm.incr_indexes (maxt+1) thm, Thm.cterm_incr_indexes (maxt+1) elhs); |
855 val insts = if fo then Thm.cterm_first_order_match (elhs', eta_t') |
855 val insts = if fo then Thm.cterm_first_order_match (elhs', eta_t') |
856 else Thm.cterm_match (elhs', eta_t'); |
856 else Thm.cterm_match (elhs', eta_t'); |
857 val thm' = Thm.instantiate insts (Thm.rename_boundvars lhs eta_t rthm); |
857 val thm' = Thm.instantiate insts (Thm.rename_boundvars lhs eta_t rthm); |
858 val prop' = Thm.prop_of thm'; |
858 val prop' = Thm.prop_of thm'; |
859 val unconditional = (Logic.count_prems (prop',0) = 0); |
859 val unconditional = (Logic.count_prems prop' = 0); |
860 val (lhs', rhs') = Logic.dest_equals (Logic.strip_imp_concl prop') |
860 val (lhs', rhs') = Logic.dest_equals (Logic.strip_imp_concl prop') |
861 in |
861 in |
862 if perm andalso not (termless (rhs', lhs')) |
862 if perm andalso not (termless (rhs', lhs')) |
863 then (trace_named_thm "Cannot apply permutative rewrite rule" ss (thm, name); |
863 then (trace_named_thm "Cannot apply permutative rewrite rule" ss (thm, name); |
864 trace_thm "Term does not become smaller:" ss thm'; NONE) |
864 trace_thm "Term does not become smaller:" ss thm'; NONE) |