let to_string r =
match r with
| Succ i -> sprintf "Succ %d" i
| Neg i -> sprintf "Neg %i" i
| Plus (i, j) -> sprintf "Plus (%d, %d)" i j
| Sub (i, j) -> sprintf "Sub (%d, %d)" i j
| Times (i, j) -> sprintf "Times (%d, %d)" i j
| Eq (i, j) -> sprintf "Eq (%d, %d)" i j