# Semicontinuity of cohomology of torsion-free sheaves restricted to divisors

Let $$X$$ be a smooth projective variety, $$\mathcal{E}$$ a torsion-free coherent sheaf on $$X$$ and $$\mathfrak{d}$$ a linear system of divisors in $$X$$.

I would like to show (at least when $$X$$ is a surface) the upper semicontinuity of the map $$D\in\mathfrak{d}\longmapsto h^0(D,\mathcal{E}{\restriction_D})\,.$$ I considered the incidence locus $$Z\subset X\times\mathfrak{d}$$ and the projections $$p:Z\to X$$ and $$q:Z\to\mathfrak{d}$$. If $$\mathcal{E}$$ is locally free, then $$p^*\mathcal{E}$$ is flat over $$\mathfrak{d}$$, so by the semicontinuity theorem $$h^0(D,\mathcal{E}{\restriction_D})=h^0(q^{-1}(D),p^*\mathcal{E}{\restriction_{q^{-1}(D)}})$$ is indeed upper semicontinuous in $$D$$. But what if $$\mathcal{E}$$ is only torsion-free? Is $$p^*\mathcal{E}$$ still flat over $$\mathfrak{d}$$?