fix(replace_using_ctx): fix inconsistent cache bug in replace_using_ctx, and add tests that expose the problem

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
fix(type_checker): fix inconsistent cache bug in type_checker, add tests that expose the problem

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
fix(light_checker): fix inconsistent cache bug in light_checker, add tests that expose the problem

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
feat(library/rewriter): add skeleton for depth rewriter
refactor(library/rewriter): have separate functions to build RW results from components
feat(library/rewriter): add apply_rewriter_fn skeleton