You can't just look at the funding for math departments. I think the value generation potential of every mathematician in the world could exceed that of the capex of these companies. How much is "lost" when a brilliant mind goes into pure math research instead of nuclear engineering, or civil engineering etc. Cumulatively, a lot.
Edit: I'm fine saying we're spending too much money on AI, in fact I agree, but "theorems" are not the only output of these companies. It's almost definitely not going to be worth the expenditure, but the benefits are not going to be only lean proofs