fact: Definition rewrite (t : term) (d : data) : option term := let (p,a) := d in let (l,r) := a in if mem beq_rule (mkRule l r) R then match subterm_pos t p with | None => None | Some u => match matches l u with | None => None | Some s => replace_pos t p (sub s r) end end else None.
imports: Coq(Euclid Wf_nat) CoLoR(LogicUtil ATrs ListUtil RelUtil AMatching ListDec APosition NatUtil)