let apply f r a =
let (a', alpha') = f a in
match r a' with
| (Three.Yes(tau) as res) ->
if a == a' then res else Three.Yes(dep2 tau alpha')
| (Three.No(tau) as res) ->
if a == a' then res else Three.No(dep2 tau alpha')
| Three.X ->
Three.X