SkillAgentSearch skills...

Huffman

Correctness proof of the Huffman coding algorithm in Coq [maintainer=@palmskog]

Install / Use

/learn @rocq-community/Huffman
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<!--- This file was generated from `meta.yml`, please do not edit manually. Follow the instructions on https://github.com/coq-community/templates to regenerate. --->

Huffman

Docker CI Contributing Code of Conduct Zulip

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

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

View on GitHub
GitHub Stars13
CategoryDevelopment
Updated2mo ago
Forks4

Languages

Rocq Prover

Security Score

80/100

Audited on Jan 27, 2026

No findings