Hoare Logic in Formal Methods
Hoare Logic in Formal Methods
Hoare logic in
formal methodsGroup 3
Dr. Hafizul Fahri Bin Hanafi
Team
2. Definition
2. Definition
2.1 Axiom
2.2 Rules
2. Definition
Hoare logic is one of the most used formal methods
for demonstrating soundness. Each programming
language has its own Hoare logic, which can be a
time-consuming process. We argue that and are
expressions in the assertion language and P is a
programme phrase in the programming language.
2.1 Axiom
{false} S{q} for any program “S” and any
postconditions “q”
{p} S{true} for any program “S” and any
precondition “p”
1
2.2 Rules
Assignment Statement Rule
2
Sequence Rule
3
Conditional Rule
2.2 Rules
4 5
Iteration Rule
Alternation Rule
6
Consequence Rule
Hoare Logic in Formal Methods
3. type of hoare's
logic
3.1 Relational Hoare Logic (RHL)
3.2 Probabilistic Hoare Logic
3.3 Probabilistic Relational Hoare Logic
3.1 Relational hoare logic rhl
Relational Hoare Logic (RHL) is a variant of traditional Hoare logic.
RHL compares two instructions (or programmes) based on whether
they map a specific pre-relation into a specific post-relation. The
central concept in RHL is what we may call a Hoare quadruple.
4. advantages
5. disadvantages
advantages
Precision Tool Support
Understandability
High-Assurance
Widely Accepted
disadvantages
Difficulty
Lack of Flexibility
Time-Consuming
Resource-intensive
Limited Applicability
Hoare Logic in Formal Methods
6. conclusion
CONCLUSION
Hoare logic is a powerful and widely used method for formally verifying the correctness of
computer programs. Its rules provide a precise and rigorous way to specify the behavior of
a program, and can be used to prove that a program will always produce the desired
output for a given input. Hoare logic uses a set of rules, known as the Hoare rules or Hoare
triples.
Assignment Statement Rule
Alternation Rule
Iteration Rule