(*

The following code does not work because we cannot handle properly
the associativity of the concatenation

[* concatenation *]

fun concat0/2.

[* fst returns the first atomic component of a concatenation *]
reduc fst(concat0(x,y)) = x.
[* rest returns a concatenation without its first atomic component *]
reduc rest(concat0(x,y)) = y.

[** PB if y is itself a concatenation !!!!! **]
reduc concat(concat0(x,y),z) = concat0(x, concat(y,z));
      concat(x,y) = concat0(x,y).

[* f = keyed hash function *]

fun f/2.
fun h0/2.
reduc h(f(x,y),z) = f(x,concat(y,z));
      h(x,y) = h0(x,y).


Here is a version that works, but with pairs instead of concatenation

*)

(* f = keyed hash function *)

fun f/2.
fun h0/2.
reduc h(f(x,y),z) = f(x,(y,z));
      h(x,y) = h0(x,y).

(* macs *)

reduc badMac(x,y) = f(x,y).

reduc goodMac(x,y) = f(x,f(x,y)).

process 0
