(* Note: x must be non-zero, y is allowed to be zero (because x is a constant in all usages, its
   non-zero-check seems to be removed by the parser). *)
Definition mul_with_table(x y: Z)(pow: list int)(log: list Z): int :=
  if Int.eq (if Int.eq (Int.repr y) Int.zero then Int.zero else Int.one) Int.zero
  then Int.zero
  else Znth (Int.unsigned
               (Int.mods (Int.repr (Znth x log + Znth y log))
                  (Int.repr 255))) pow.

Lemma mul_equiv: forall (x y: Z) (pow : list int) (log : list Z), (forall j : Z, 0 <= j < 256 -> Znth j pow = pow3 j) -> Zlength pow = 256 -> (forall j : Z, 1 <= j < 256 -> Znth j log = log3 (Int.repr j)) -> Zlength log = 256 -> 1 <= x < 256 -> 0 <= y < 256 -> mul_with_table x y pow log = mul (Int.repr x) (Int.repr y).