let rec subst sigma a =
match a with
| Ite (sa, a1, a2) ->
Ite(SAtom.subst sigma sa,
subst sigma a1,
subst sigma a2)
| Comp (x, op, y) ->
let sx = Term.subst sigma x in
let sy = Term.subst sigma y in
if x == sx && y == sy then a
else Comp(sx, op, sy)
| _ -> a