let rec subst sigma t = match t with | Elem (x, s) -> let nx = Variable.subst sigma x in if x == nx then t else Elem (nx, s) | Access (a, lz) -> Access (a, List.map (fun z -> try Variable.subst sigma z with Not_found -> z) lz) | Arith (x, c) -> Arith (subst sigma x, c) | _ -> t