Localization of vanishing cycles Consider a regular holonomic D-module (or a perverse sheaf) $M$ on a smooth variety $X$. Let $f:X\to A^1$ be a polynomial (or holomorphic) function. 
Question: Is it true that the $\lambda \in A^1$ such that the vanishing cycles $\phi_{f-\lambda}(M) = 0$ is a dense open set? 
Here are my thoughts:
If $M = O_X$ (or the constant perverse sheaf $A[dim X]$), this is just the fact that the critical values of $f$ are isolated.    
In the general case, we can  factor $f$ through its graph $X\to X\times A^1$,  $x\mapsto (x,f(x))$, reducing to the case where $f$ is the (smooth) projection $t:X\times A^1 \to A^1$. Our sheaf $M$ on $X\times A^1$ has a characteristic variety $\bigcup_\alpha T^*_{S_\alpha}(X\times A^1)$ for a stratification $X\times A^1 = \bigcup_\alpha S_\alpha$. My guess is that $\phi_{t-\lambda}(M) = 0$ when $\{t-\lambda  = 0 \}$ is transverse to all the $S_\alpha$ and that this is a generic condition but I'm having trouble making this intuition precise. 
 A: An answer to this question was given to me by Pierre Schapira. This is known as the microlocal Bertini-Sard theorem (cf. Sheaves on manifolds cor. 8.3.12). 
Consider a map $f:X\to A^1$. It induces $f_\pi : X\times_{A^1} T^*A^1 \to T^*A^1$ and $f_d : X\times_{A^1} T^*A^1 \to T^*X$. Set $\Lambda = SS(M)$ the characteristic variety of $M$. This is a closed conic isotropic subset of $T^*X$. Now 
$$
  supp(\phi_{f-t}(M)) \subset [ x ~|~ f(x) = t,~(x,df(x)) \in \Lambda ]
$$ 
so 
$$
  [ t\in A^1 ~|~ \phi_{f-\lambda}(M) \neq 0 ] \subset 
  [ t\in A^1 ~|~ (t,dt)\in  f_\pi f_d^{-1}(\Lambda) ]
$$  
Now assume that $f$ is compactifiable as $X\overset{j}{\to} \bar{X} \overset{\bar{f}}{\to} A^1$, $j$ an open immersion and $\bar{f}$ proper. The closure $\bar{\Lambda}$ of $\Lambda$ is $T^*\bar{X}$ is a closed conic isotropic subset and since $\bar{f}$ is proper, $\bar{f}_\pi \bar{f}_d^{-1}(\bar{\Lambda})$ is a closed conic isotropic subset of $T^*A^1$. So its intersection with the nowhere vanishing section
$$
  [t \in A^1 ~|~ (t,dt) \in \bar{f}_\pi \bar{f}_d^{-1}(\bar{\Lambda})]
$$
has dimension 0. Since $f_\pi f_d^{-1}(\Lambda) \subset \bar{f}_\pi \bar{f}_d^{-1}(\bar{\Lambda})$ the same is true for 
$$
  [ t\in A^1 ~|~ \phi_{f-\lambda}(M) \neq 0 ] \subset 
  [ t\in A^1 ~|~ (t,dt)\in  f_\pi f_d^{-1}(\Lambda) ]
$$ 
and the theorem is proved.  
If $f$ is algebraic it is always compactifiable. If $f$ is analytic, I don't know if the theorem still holds in general.
PS: If $f(x) = \lambda $, the condition $(x,df(x)) \in T^*_Z X$ just says that the fiber $\{f = \lambda\}$ is tranverse to $Z$ at $x$. So when $SS(M) \subset \bigcup T^*_{S_\alpha} X$ this gives the geometric interpretation that the vanishing cycles are 0 whenever the fibers are transverse to the strata.  
