free c : channel.
free ev : channel [private].
free bad : bitstring [private].

fun enc(bitstring, bitstring) : bitstring.
reduc forall x:bitstring, y:bitstring; dec(enc(x,y),y) = x.


event  eventtest(bitstring,bitstring,bitstring,bitstring,bitstring,bitstring).

let protocolA(shared_k:bitstring) =
  new n_A : bitstring;
  out(c,n_A).

let protocolB(shared_k:bitstring) =
  in(c, n_A:bitstring);
  new n_B : bitstring;
  out(ev,(shared_k,n_A,n_B)).

let test_event() =
  in(ev,(sk_1:bitstring, n_A1:bitstring, n_B1:bitstring));
  in(ev,(sk_2:bitstring, n_A2:bitstring, n_B2:bitstring));
  event eventtest(sk_1,sk_2,n_A1,n_A2,n_B1,n_B2).

query sk_1:bitstring, n_A1:bitstring, n_B1:bitstring, sk_2:bitstring, n_A2:bitstring, n_B2:bitstring;
  event(eventtest(sk_1,sk_2,n_A1,n_A2,n_B1,n_B2)) ==>
  (sk_1 = sk_2 ||  n_B1 <> n_B2).

process test_event() | ! new shared_k:bitstring; (protocolA(shared_k) | protocolB(shared_k))

(* EXPECTPV
RESULT event(eventtest(sk,sk_3,n_A1_1,n_A2_1,n_B1_1,n_B2_1)) ==> sk = sk_3 || n_B1_1 ≠ n_B2_1 is true.
0.004s (user 0.004s + system 0.000s), max rss 7884K
END *)
