You should be able to do, at the very least, what you are doing, in a much simpler way.
Plus, it has procedure level pre and post conditions that are checked
In any case, the tools ADA has allows it to go further than what you want, actually. https://en.wikipedia.org/wiki/SPARK_(programming_language)
There is a formally verifiable language that is just a subset of ada (IE compilable as normal ada) but can formally verify what you want here even if static predicates can't.
(Now all of the above said, i'm not sure i'd go this route, but yeah)
http://www.adacore.com/uploads_gems/Ada_Safe_and_Secure_Book...
Note: See table of contents especially.
http://cowlark.com/2014-04-27-ada/index.html
Note: This "random walk through Ada" has a nice summary of all kinds of features it has from perspective of an outsider instead of an Ada developer.
https://en.wikipedia.org/wiki/SPARK_(programming_language)
http://www.adacore.com/uploads/technical-papers/SPARKSkein_S...
Note: Link to SPARK and an example by Rod Chapman on doing Skein in it. Just converting it from C to SPARK found an error in original code. Because of course it did haha...
Some language already did beat him to it: Ada
http://www.ada-auth.org/standards/12rat/html/Rat12-2-4.html
Ada's rules for type invariants check them in all the places you would expect, and are straightforward to use.
It's about as correct as you can get without it being impossible to compute :)