let rec variables = function | Elem (x, Var) -> Variable.Set.singleton x | Access (_, lx) -> List.fold_left (fun acc x -> Variable.Set.add x acc) Variable.Set.empty lx | Arith (t, _) -> variables t | _ -> Variable.Set.empty