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

free k:bitstring [private].

fun h(bitstring): bitstring.

select x:bitstring; mess(c,*x) [ignoreAFewTimes].
noselect x:bitstring; mess(d,*x) [ignoreAFewTimes].

(* A noselect declaration takes precedence over a select declaration (to avoid
  termination issues). So in the following rule,

  attacker(enc(y'_1,y_1)) && mess(d[],y_1) -> attacker(y'_1)

  attacker(enc(y'_1,y_1)) is selected.
  *)

query attacker(k).

set verboseRules = true.

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

process
  (in(c,x:bitstring);
  let y = dec(x,k) in
  out(d,h(y)))

  | (in(d,z:bitstring);
    in(c,z':bitstring);
    let y' = dec(z',z) in
    out(c,y'))

(* EXPECTPV
Error: The option ignoreAFewTimes cannot be used with a positive select (or a negative nounif).
xtime: error in child process (status : 2)
END *)
