I’ve personally never felt the need to do any sort of heavyweight mental type checking. Most of the inference done by proof assistants such as Agda and Idris feels pretty straight forward and obvious most of the time to me. If you remove the inference, it feels harder to read.
Sure; That is why I always use global type inference in Haskell exclusively as a development aid, but end up committing small functions with type signatures on them even if I could leave them out. So I think what is really important is type signatures on functions.
Inference is best when it removes things that you can easily infer yourself from the context (as in my snippet above).
I would say we are pretty reliant on the compiler in Rust today, getting great error messages about borrows and such. With Agda and Idris, you even have interactive modes where you can essentially let the compiler write the program for you. What is important then is the type signature. If the signature specifies enough, then you don’t really need to look at the body of functions.
I believe C++'s error messages are uniquely bad because it is template metaprogramming, that is: it is macro based… and substitution failures are not errors. I don’t think error messages are anything like that in the proof assistants.
I think it is mistaken to say that just because we can’t verify 100%, doesn’t mean we can’t gain a lot more confidence by employing some formal verification. After all, Agda and such languages have JavaScript backends, so then you have to trust the JavaScript engines… So should we give up on formal verification then?
Furthermore, you usually don’t verify the entire compiler. Idris for example is written in Haskell. What is proved (sometimes not even mechanically verified) is the soundness of the proof kernel, which is usually a much smaller part.
It would be good to do so, but it is not strictly necessary. unsafe { .. } can essentially be seen as “this part of the proof has been done on paper or in my brain”.
I disagree. You can formally verify things or specify your invariants more precisely in the small. You don’t have to verify every single part of your program for it to be useful. Do it where it matters most. This is how the type system is used even today. Some APIs are more stringly, some are more type safe.
Some basic stuff could and should be taught yes. We need to advance the teaching in this area for sure.
However, it is not so much formal verification that needs teaching, but rather dependent types.
Finally I would say that I’m not advocating we rush to add run-time-dependent types to Rust. It should take its time. We already have a long backlog of other features to implement and ship. The research into dependent types in Rust also needs to be done. It is not something you just add without scientific research before.
That said, we have already started to add some more formal verification facilities with const generics, GATs, etc…