Skip to main content
Log in

Proof Pearl: Mechanizing the Textbook Proof of Huffman’s Algorithm

  • Published:
Journal of Automated Reasoning Aims and scope Submit manuscript

Abstract

Huffman’s algorithm is a procedure for constructing a binary tree with minimum weighted path length. Our Isabelle/HOL proof closely follows the sketches found in standard algorithms textbooks, uncovering a few snags in the process. Another distinguishing feature of our formalization is the use of custom induction rules to help Isabelle’s automatic tactics, leading to very short proofs for most of the lemmas.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aho, A.V., Hopcroft, J.E., Ullman, J.D.: Data Structures and Algorithms. Addison-Wesley, Reading (1983)

    MATH  Google Scholar 

  2. Berghofer, S., Nipkow, T.: Random testing in Isabelle/HOL. In: Cuellar, J., Liu, Z. (eds.) Software Engineering and Formal Methods (SEFM 2004), pp. 230–239. IEEE Computer Society, Los Alamitos (2004)

    Chapter  Google Scholar 

  3. Bird, R., Wadler, P.: Introduction to Functional Programming. Prentice Hall International Series in Computer Science. Prentice Hall, Hemel Hempstead (1988)

    Google Scholar 

  4. Blanchette, J.C.: An Isabelle/HOL formalization of the textbook proof of Huffman’s algorithm. Archive of Formal Proofs. http://afp.sourceforge.net/entries/Huffman.shtml (2008)

  5. Bulwahn, L., Krauss, A.: Finding lexicographic orders for termination proofs in Isabelle/HOL. In: Schneider, K., Brandt, J. (eds.) Theorem Proving in Higher Order Logics (TPHOLs 2007). Lecture Notes in Computer Science, vol. 4732, pp. 38–53. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  6. Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn. MIT, Cambridge (2001)

    MATH  Google Scholar 

  7. Gordon, M.J.C., Melham, T.F. (eds.): Introduction to HOL: A Theorem Proving Environment for Higher Order Logic. Cambridge University Press, Cambridge (1993)

    MATH  Google Scholar 

  8. Haftmann, F., Nipkow, T.: A code generator framework for Isabelle/HOL. In: Schneider, K., Brandt, J. (eds.) Theorem Proving in Higher Order Logics (TPHOLs 2007). Lecture Notes in Computer Science, vol. 4732, pp. 128–143. Springer, Heidelberg (2007)

    Google Scholar 

  9. Huffman, D.A.: A method for the construction of minimum-redundancy codes. In: Proc. IRE 40(9), pp. 1098–1101 (1952)

  10. Knuth, D.E.: The Art of Computer Programming, Vol. 1: Fundamental Algorithms, 3rd edn. Addison-Wesley, Reading (1997)

    MATH  Google Scholar 

  11. Krauss, A.: Automating Recursive Definitions and Termination Proofs in Higher-Order Logic. Ph.D. thesis (submitted), Dept. of Informatics, T. U. München (2009)

  12. Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised Edn.). MIT, Cambridge (1997)

    Google Scholar 

  13. Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL: A Proof Assistant for Higher-order Logic. Lecture Notes in Computer Science, vol. 2283. Springer, Heidelberg (2002) (Updated version http://isabelle.in.tum.de/doc/tutorial.pdf, 2008)

    MATH  Google Scholar 

  14. Théry, L.: A correctness proof of Huffman algorithm. http://coq.inria.fr/contribs/Huffman.html (2003). Accessed 24 September 2008

  15. Théry, L.: Formalising Huffman’s algorithm. Tech. report TRCS 034, Dept. of Informatics, Univ. of L’Aquila (2004)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jasmin Christian Blanchette.

Additional information

This work was supported by the DFG grant NI 491/11-1.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Blanchette, J.C. Proof Pearl: Mechanizing the Textbook Proof of Huffman’s Algorithm. J Autom Reasoning 43, 1–18 (2009). https://doi.org/10.1007/s10817-009-9116-y

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10817-009-9116-y

Keywords

Navigation