const a:bitstring.
const b:bitstring.
fun h(bitstring):bitstring.
fun f(bitstring):bitstring.
fun g(bitstring,bitstring,bitstring):bitstring.

equation forall x:bitstring, y:bitstring; g(h(x),y,a) = y;
         forall x:bitstring, y:bitstring; g(f(x),b,y) = y [convergent].

event e1(bitstring).
event e2(bitstring).

query x:bitstring, y:bitstring, z:bitstring; event(e2(g(x,y,z))) ==> event(e1(y)).

process
  event e1(a);
  event e2(a)

(*

This example illustrates a choice in the semantics of the correspondence query when
we have equations.

Semantics 1:

for all \sigma, T |- e2(u)\sigma ==> exists. \sigma' st  T |- e1(y)\sigma' and
 e2(u)\sigma =_E e2(u)\sigma'

Semantics 2:

for all \sigma, T |- e2(u)\sigma ==> exists. \sigma' st  T |- e1(y)\sigma\sigma' and
e2(u)\sigma = e2(u)\sigma'

In the first semantics, the query would hold with
\sigma = { x -> h(x'), y -> a; z -> a } and \sigma' = { y -> a }
or
\sigma = { x -> f(x'), y -> b; z -> a } and \sigma' = { y -> a } ( since e2(f(x'),b,a) =_E e2(a) )

but it would not hold in the second semantics.

Note that when we deactivate the check of function symbol with equations in it, the query
is proved by ProVerif. So it seems that the tool currently considers the first semantics. Bruno would prefer the second one.

*)

(* EXPECTPV
Error: Incorrect query.
xtime: error in child process (status : 2)
END *)
