free c:channel.
free d:channel [private].

fun h(bitstring):bitstring.

const a,b:bitstring.

event A(bitstring).
event B(bitstring).

const ok,ko,k:bitstring[private].

lemma x:bitstring;
  event(B(x)) ==> x = b for { public_vars x };
  event(B(x)) ==> x = b for { secret x [real_or_random] }.

(* lemma x:bitstring;
  event(B(x)) ==> x = a;
  event(A(x)) ==> x = b. *)

pred Test(bitstring) [block].


query x:bitstring; event(A(x)) ==> event(B(a)) public_vars x; attacker(x) public_vars x.
noninterf d.
weaksecret d.
query secret x [real_or_random].

process
  (in(c,x:bitstring);
  if x = a
  then
    event A(a);
    out(d,k)
  else
    out(c,ko))

  | in(d,x:bitstring); out(c,ok)

(* EXPECTPV
RESULT event(B(x_2)) ==> x_2 = b cannot be proved.
RESULT event(B(x_2)) ==> x_2 = b public_vars x_1,x is true.
RESULT event(A(x_2)) ==> event(B(a)) public_vars x_1,x is false.
RESULT not attacker(x_2) public_vars x_1,x is false.
RESULT Non-interference d cannot be proved.
RESULT Weak secret d is true.
0.080s (user 0.044s + system 0.036s), max rss 9224K
END *)
