{ comments are enclosed by curly-braces; no nested comments are allowed } { addition these rules work when the arguments are numerals but not for all arbitrary expressions } Add Z y => y; Add (S x) y => S (Add x y); Add (Add x y) z => Add x (Add y z); Add (Mult (S x) y) z => Add y (Add (Mult x y) z); Add (Mult Z y) z => z; { define multiplication (Mult) here } Mult (Add x y) z => Add (Mult x z) (Mult y z) ; Mult Z y => Z; Mult (S x) y => Add y (Mult x y); Mult (Mult x y) z => Mult x (Mult y z) ; { when all other computation is done } Compute x => x; . { end of rules }