Huffman
Correctness proof of the Huffman coding algorithm in Coq [maintainer=@palmskog]
Install / Use
/learn @rocq-community/HuffmanREADME
Huffman
This projects contains a Rocq proof of the correctness of the Huffman coding algorithm, as described in David A. Huffman's paper A Method for the Construction of Minimum-Redundancy Codes, Proc. IRE, pp. 1098-1101, September 1952.
Meta
- Author(s):
- Laurent Théry (initial)
- Karl Palmskog <img src="https://zenodo.org/static/images/orcid.svg" height="14px" alt="ORCID logo" />
- Rocq-community maintainer(s):
- Karl Palmskog (@palmskog)
- License: GNU Lesser General Public License v2.1 or later
- Compatible Rocq/Coq versions: 8.12 or later
- Additional dependencies: none
- Rocq/Coq namespace:
Huffman - Related publication(s):
Building and installation instructions
The easiest way to install the latest released version of Huffman is via OPAM:
opam repo add rocq-released https://rocq-prover.org/opam/released
opam install coq-huffman
To instead build and install manually, do:
git clone https://github.com/rocq-community/huffman.git
cd huffman
make # or make -j <number-of-cores-on-your-machine>
make install
Documentation
For more information about the project, see the technical report describing the formalization.
Running extracted code
To extract code and obtain the program, run
make run_huffman.ml
Next, open an OCaml toplevel (e.g., ocaml) and do
#use "run_huffman.ml";;
To get the code that gives the frequency string:
let code = huffman "abbcccddddeeeee";;
To code a string:
let c = encode code "abcde";;
To decode a string:
decode code c;;
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
