Earlier quoted context omitted.
Proving that a program meets its specification.
Is Hoare logic a tool in that process?
A Hoare Logic for Rust
21–30 of 48 posts
Re: A Hoare Logic for Rust
#22Earlier quoted context omitted.
Is Hoare logic a tool in that process?
Yes. Hoare logic's inference rules define which Hoare triples can be “legally” derived. The programmer's task isn't only to provide a Hoare triple (which by itself is just an assertion that a program meets a specification), but also to provide a derivation of that triple (the actual proof of the assertion). Design by contract is akin to giving a Hoare triple, but never giving its derivation.
Re: A Hoare Logic for Rust
#23Earlier quoted context omitted.
Yes. Hoare logic's inference rules define which Hoare triples can be “legally” derived. The programmer's task isn't only to provide a Hoare triple (which by itself is just an assertion that a program meets a specification), but also to provide a derivation of that triple (the actual proof of the assertion). Design by contract is akin to giving a Hoare triple, but never giving its derivation.
Design by contract, is it based or not based on Hoare logic?
Re: A Hoare Logic for Rust
#24Re: A Hoare Logic for Rust
#25Earlier quoted context omitted.
Design by contract, is it based or not based on Hoare logic?
It's not. In DbC, you have preconditions and postconditions, but no means whatsoever to actually prove that, whenever the procedure's initial state meets the precondition, its final state will meet the postcondition.
Re: A Hoare Logic for Rust
#26Earlier quoted context omitted.
Design by contract, is it based or not based on Hoare logic?
It's not. In DbC, you have preconditions and postconditions, but no means whatsoever to actually prove that, whenever the procedure's initial state meets the precondition, its final state will meet the postcondition.
Re: A Hoare Logic for Rust
#27Earlier quoted context omitted.
Design by contract, is it based or not based on Hoare logic?
It's not. In DbC, you have preconditions and postconditions, but no means whatsoever to actually prove that, whenever the procedure's initial state meets the precondition, its final state will meet the postcondition.
So design by contract, based on Hoare logic, applied in languages like SPARK Ada and Eiffel, produces statements that are unverifiable.
But Hoare logic, a thing without an executable implementation, produces statements which are verifiable.
Re: A Hoare Logic for Rust
#28Earlier quoted context omitted.
Design by Contract: http://c2.com/cgi/wiki?DesignByContract Which is a key element of the Eiffel language ( https://en.wikipedia.org/wiki/Eiffel_(programming_language) ). SPARK Ada also includes this concept of pre/post conditions: https://en.wikipedia.org/wiki/SPARK_(programming_language) I haven't programmed in the latter, but I'd like to. Since I'm often in the maintenance end of the software cycle I don't have mu…
Design by contract has nothing to do with formal verification, though.
You state that design by contract has nothing to do with formal verification. You also later said that Hoare logic is a tool for formal verification. Design by contract is an implementation/application of Hoare logic. Ergo, it has something to do with formal verification.
I've never said it is formal verification, I've only said that it is part of it. It requires tooling and proper application for it to be useful/correct/effective. But that's true of everything in formal verification.
Re: A Hoare Logic for Rust
#29Earlier quoted context omitted.
Design by Contract: http://c2.com/cgi/wiki?DesignByContract Which is a key element of the Eiffel language ( https://en.wikipedia.org/wiki/Eiffel_(programming_language) ). SPARK Ada also includes this concept of pre/post conditions: https://en.wikipedia.org/wiki/SPARK_(programming_language) I haven't programmed in the latter, but I'd like to. Since I'm often in the maintenance end of the software cycle I don't have mu…
Design by contract has nothing to do with formal verification, though.
If you don't have a well-defined contact, you won't be able to verify that context is adhered to.
Re: A Hoare Logic for Rust
#30Very nice! Is work being done to produce a formal, verifiable specification? edit : I'm particularly interested in formal specifications and their use in open source software.
The contribution here is a formalization of borrowing and ownership semantics very close to Rust's, plus a sketch of how one would prove that these semantics give memory safety. The techniques can probably be adapted to an analysis of Rust itself.
Benitez, S. "Rusty Types for Solid Safety." ACM PLAS 2016. https://sergio.bz/docs/rusty-types-2016.pdf
(Full disclosure: Sergio and I are colleagues.)