2. There has already been tons of work into formal specification of programs.
The main limiting factor is that sufficiently formal specification to avoid issues trends towards formal proofs.
When I was at uni doing my MSc, I did some work with F* (FStar), a F#-derivative that makes the type system a fully formal proof. It was cool, and made tests obsolete, because you had a stronger guarantee.
The problem with FStar or any other formsl verification (which to be clear, has been used in conjunction with LLMs as stochastic code fuzzers to produce mesningful results) is that writing the correct specification takes longer than just writing the program.
Thst might be worth it for the guarantees it gives us, in some cases. Byt not for most software, and certsinly not for software where precision is explicitly—by thevuse of "AI"—devalued in favor of speed.*
* Speed here, embarrasingly, being speed of code gen, not speed of value delivery.