let norm_Xor purifie (sub : t_subst) (lst : term list) : term list * t_subst =
(* Insert an element " in a sorted list ", modulo nilpotence
(i.e. t::t::l = l) *)
let rec insere_xor s l t =
match l with
| tt::fin -> ( match comp s t tt with
| 0 -> fin
| x ->
if x<0 then
t::l
else tt::(insere_xor s fin t) )
| [] -> [t]
and norm_Xacun = function
| (Xor l)::fin -> norm_Xacun (l@fin)
| t::fin ->
(let (l,s) = norm_Xacun fin in
match purifie s t with
| (Var n as t, ss) ->
(match valeur n ss with
| Var(_) as tt -> (insere_xor ss l tt, ss)
| Xor(ll) -> (it_list (insere_xor ss) l ll, ss)
| Atm(0) -> (l,ss)
(* | Atm(_) as tt -> (insere_xor ss l tt, ss) Removed for Atom theory separation. *)
| _ -> (insere_xor ss l t, ss) )
| (Xor(ll), ss) -> (it_list (insere_xor ss) l ll, ss)
| (Atm 0, ss) -> (l,ss)
(* | (Atm _ as t, ss) -> (insere_xor ss l t, ss) Removed for Atm theory separation. *)
| (t, ss) ->
let (nv,ns) = add_newvalue ss t
in (insere_xor ns l nv, ns) )
| _ -> ([], sub)
in
norm_Xacun lst