Question. Are there any formal systems out there for which $$\forall x \in \mathbb{R}(x \neq 0 \rightarrow x^{-1} \neq 0)$$
is true, but the contrapositive
$$\forall x \in \mathbb{R}(x^{-1} = 0 \rightarrow x = 0)$$
is "ill-formed" or "ill-typed" (or whatever)?
Motivation 0. This seems to accord well with mathematical practice; in the sense that if you asked a typical mathematician whether or not the first statement was true, they'd probably say 'yes', but if you asked them whether the second statement was true, they'd probably start feeling uncomfortable, and probably suggest adjoining an $x \neq 0$ premise.
Motivation 1. I'm interested in whether there's formal systems out there that provide convenient ways of reasoning about functions whose domain isn't exactly what you wish it were.
Also, please, no answers of the form "this makes no sense because..." I think that, as a general rule, jumping to these kinds of conclusions too quickly is stifling and just an all-round bad idea.
I addressed this in a comment on some SE answer I can no longer find. One way is to adopt guarded conditionals like the ternary operator in programming language, which allows us to enforce syntactic type-checking restrictions. In general one would probably like to have at least: $\def\imp{\rightarrow}$ $\def\cand{\mathbin{?\land}}$ $\def\cimp{\mathbin{?{\rightarrow}}}$ $\def\then{\mathbin{?}}$
Then in the context where $x$ is real, "$x \ne 0 \cimp x^{-1} \ne 0$" is syntactically valid and true, because "$x^{-1}$" is valid in the subcontext where $x \ne 0$. In contrast "$x^{-1} = 0 \imp x = 0$" is syntactically invalid and hence meaningless since $^{-1}$ is a function that only accepts nonzero reals.
Division by zero is just one example, but it is not a very good one because some people would just force $0^{-1} = 0$ in the formal system so that they can get away with not solving the problem. However, there are many other instances of such things which are not so easily solved. For example, one instance of Bolzano-Weierstrass theorem is: $\def\nn{\mathbb{N}}$ $\def\rr{\mathbb{R}}$
But "$f(n)$" is syntactically valid only if $f$ is a function! We have two options:
Use guarded conditionals in the same way as for the real inverse, namely as in the sentence "$\forall f\ ( f \in Func(\nn,[0,1]) \cimp \cdots )$".
Allow restricted quantifiers such as "$\forall f \in Func(\nn,[0,1])$" and therefore we can allow the use of $f$ under the scope of quantification as a function.
The division example could be stated using the second option as in "$\forall x \in \rr_{\ne 0} ( x^{-1} \ne 0 )$", but to define "$\rr_{\ne 0}$" probably still needs the first option as in "$\{ r : r \in \rr \cand r \ne 0 \}$". The 'converse' that is as you say ill-formed would indeed be syntactically invalid, because "$\{ r : r \in \rr \cand r^{-1} \ne 0 \}$" is invalid.
Anyway I prefer having both options. Unfortunately, I don't know enough about existing computer proof assistants to tell you whether any of them support this. Probably any system that has a strict type system will support this, but potentially not allow you to do mathematics as freely as you might want. (Coq does not allow subtyping. Mizar does but its types are only in the sense of abbreviation power.)