let rec delete p trie = match trie with
| Empty -> Empty
| Full v -> if p v then Empty else trie
| Node l ->
let l' = delete_list p l in
if l == l' then trie else Node l'
and delete_list p l = match l with
| [] -> []
| (atom, t):: n ->
let t' = delete p t in
let n' = delete_list p n in
if t'==t && n'==n then l else (atom,t')::n'