Implementing Contextual Rewriting

Contextual rewriting as a generalization of conditional rewriting has been studied in different forms. We show that contextual rewriting is a powerful simplification rule for the first-order theorem proving with equality and preserves the refutational completeness of many reasoning systems. After comparing definitions of contextual rewriting by Boyer-Moore, Remy, Ganzinger and Zhang-Kapur, we show that the definition of Zhang-Kapur is more suitable for implementation because it is natural to organize the context as a ground term rewriting system. We provide a detailed procedure for simplying clauses using contextual rewriting. We also provide a solution on how to handle variables which appear only in the condition of a conditional rewrite rule.