In Gelfand and Fomin's Calculus of Variations, they present the lemma
If $ \alpha(x) $ is continuous in $ [a, b] $, and if $ \int_a^b \alpha (x) h(x) \textrm{d}x = 0 $ for every continuous function $ h(x) $ such that $ h(a) = h(b) = 0 $, then $ \alpha(x) = 0 $ for all $ x \in [a, b] $.
The authors claim that the proof that follows is by contradiction, but from what I can tell, it appears to be a proof by contrapositive---yet, I can't quite grasp it. They assume $ \alpha(x) > 0 $ on some interval $ [x_1, x_2] \subset [a, b] $ and set $ h(x) = (x - x_1)(x - x_2) $ in $ [x_1,x_2] $ (but equal to zero elsewhere $ [a, b] $), then show that the integral is also greater than zero.
In a rough first-order sense, the lemma seems to have the form $ (\forall a)(P(a) \rightarrow Q) $, with the integral being $ P $, the quantified variable representing all functions $ h $ that satisfy the given conditions, and $ Q $ being the state of $ \alpha = 0 $. But it seems to me that the authors prove $ (\exists a)(\neg Q \rightarrow \neg P(a)) $, when the contrapositive proof should have a $ \forall $ quantifier instead.
Shouldn't the proof involve $ h $ being literally all/any possible functions that satisfy the necessary properties? It seems like picking one specific function proves nothing at all, and I can't see why it works to just pick one function. Did I mess my first-order logic up?