F# RISC-V Instruction Set Formal Specification
github.com
github.com
Under normal circumstances programming code is unambiguous and should therefore suffice as a formal definition / specification (with most programming errors stemming from the fact that this formal definition doesn't match the informal definition the programmer or customer had in mind).
[1]: For comparison, https://en.wiktionary.org/wiki/formal defines 'formal' as: "(mathematics) Relating to mere manipulation and construction of strings of symbols, without regard to their meaning".
Yes. But as you say, by that token any instruction set simulator could be called a "formal specification" (modulo undefined behavior, or if you deliberately wrote in a language with nondeterminism). But we don't call them that, because (I maintain) there is something more to being a "formal specification". Namely, being in a form that is easily amenable to formal methods tools, and the intention to apply these tools.
Now of course a pure F# or Haskell program is much closer than C to being analyzed by formal methods tools, but there is still a gap that wouldn't be there if the specification were written directly in Coq or Agda or Isabelle or whatever.
If anything code allows for a higher level of formality than all but the most formal mathematics. Which is why some mathematicians are advocating that mathematical proofs should be specified as code [1]. You shouldn't confuse the existence of these languages to mean that any code not capable of expressing mathematical proofs is not formal. It might be limited, but not informal.
For instance part of sel4's proof chain is a machine readable model of an ARM. It then uses that to prove equivalence of the generated binary to the high level spec of the kernel.
> "It is distinctive among widely used languages in that it has a formal specification, given as typing rules and operational semantics in The Definition of Standard ML (1990, revised and simplified as The Definition of Standard ML (Revised) in 1997)."
https://en.wikipedia.org/wiki/Standard_ML
edit, the specification itself: http://sml-family.org/sml97-defn.pdf
He wanted a more modern platform than ocaml, or ml. He didn't want to go too deep down into the functional rabbit hole(haskell), and he didn't want to think about memory management at all(rust).
F# is because it's as good programming language as any.