I believe that that link already exists in tools like Liquid Haskell, Dafny and Verus: the spec sits on the function itself, and if the code doesn't match it, it doesn't compile.