let gc f s = let gc1 x = assert(Term.is_var x); if f x then restrict s x in Term.Var.Set.iter gc1 s.removable