let rec clot_light (s : t_subst) (t : term) : term =
match t with
| Atm(_) as t -> t
| Var(n) ->
( let t = valeur n s in
match t with
| Var(_) as t -> t
| _ -> clot_light s t
)
| PCrypt(m,k) -> PCrypt (clot_light s m, clot_light s k)
| SCrypt(m,k) -> SCrypt (clot_light s m, clot_light s k)
| Uplet(l) -> Uplet (List.map (clot_light s) l)
| PInv(t) -> inverse (clot_light s t)
| Xor(l) ->
let rec f = function
| t::l ->
let l = f l in
let t = clot_light s t in
(t::l)
| _ -> []
in Xor(f l)
| Exp(t,l) ->
let l = List.rev_map (fun (t,si) -> (clot_norm s t, si)) l
in match clot_light s t with
| Exp(t,ll) -> Exp(t, merge_exp ll l)
| t -> Exp(t, List.rev l)