Formally Verifying the Correctness of AVL Trees
This page contains the documentation for the Coq proofs written to verify our implementations of the lookup and insertion operations on AVL Trees. To view the code corresponding to the implementation, see the github page . To get a sense of how the proofs proceed, it is recommended that the libraries in the project be viewed in the following order:
This library contains general lemmas used across the project. The notion of an ordering comparison function is defined in this library.
This library contains the Gallina implementation of the insertion and lookup functions, and the predicates for soundness, balancedness, and orderedness.It also contains fold unfold lemmas for the functions, which are key to algebraically reasoning about our programs.
This library contains the specifications for the insertion and lookup functions, the statement of theorems claiming that the implementations meet these specifications, and the proofs for these theorems. The proof for lookup is trivial, while fairly complex for insertion. The latter proof is constructed with the help of 3 key lemmas which are discussed in the next section
The 3 key lemmas used to show the correctness of the insertion implementation were:
This library contains lemmas concerning the soundness property.
This library contains lemmas concerning the balancedness property.
This library contains the most importatnt lemmas for the orderedness property, including:
The library builds on helper lemmas defined in ordered_helper
paraphernalia
hbt
theorems
Lemmas
- Insertion preserves the soundness invariant
- Insertion preserves the balancedness invariant
- Insertion preserves the orderedness invariant
sound
balanced
ordered_main
- The lemma to relate the inserted element to a payload in terms of an ordering
- The lemmas to show that rotations preserve order
- The lemma to show that insertion preserves orderedness