The "transaction" which contains the input data for a script, can be set by any external entity. How do you propose to require that the bits & bytes of that input data declares its dependencies when it is impossible to force the external entity to declare where the data came from? You seem to not understand some basic facts about modularity and type systems in programming. Even if you could force the external entity to declare the full lineage of the input data (i.e. 100% dependently typed), that would require that the scripting can't be programmable, i.e. the external I/O capability would be eliminated...