let map ctxt a = match a with | Var _ -> ctxt(a) | App(f, l) -> let l' = mapl ctxt l in if l == l' then a else mk_app f l'