fix(kernel/replace): make it more robust, and add clear method

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
feat(library/tactic): add tactic framework APIs

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>