Constraint Handling Rules

The more you CHR, the better you are.

CHR Book Cover

Thom Frühwirth

Constraint Handling Rules. Textbook, Cambridge University Press, ISBN 9780521877763, 2009.

The standard reference authored by the designer of CHR

– Provides a CHR tutorial for easy introduction –

An essential source for researchers, lecturers, graduate students and professional programmers.

Press Commentaries

The reference on Constraint Handling Rules, covering both theory and practice. Professor Pascal Van Hentenryck, Brown University, Rhode Island, USA
This is a great book illustrating both the simplicity and power of Constraint Handling Rules, the purest form of rule based programming I know. Professor Peter J. Stuckey, University of Melbourne, and National ICT Australia


This book, written by the creator of Constraint Handling Rules (CHR), describes the theory of CHR and how to use it in practice. After a basic tutorial, the author describes in detail the CHR language and discusses guaranteed properties of CHR programs. The author then compares CHR with other formalisms and languages and illustrates how it can capture their essential features. Finally, larger programs are introduced and analyzed in detail. These include constraint solvers and implementations of classical algorithms. The book is ideal for graduate students and lecturers, and for more experienced programmers and researchers, who can use it for self-study. Exercises with selected solutions, and bibliographic remarks are included at the ends of chapters. The book is the definitive reference on CHR.

Table of Contents

  • Preface
  • Part I. CHR Tutorial:
  • 1. Getting started
  • 2. My first CHR programs
  • Part II. The CHR Language:
  • 3. Syntax and semantics
  • 4. Properties of CHR
  • 5. Program analysis
  • 6. Rule-based and graph-based formalisms in CHR
  • Part III. CHR Programs and Applications:
  • 7. My first CHR programs, revisited for analysis
  • 8. Finite domain constraint solvers
  • 9. Infinite domain constraint solvers
  • 10. Union-find algorithm
  • Bibliography
  • List of figures
  • List of illustrations
  • Index